public async Task<ActionResult> Index() { var list = RedisGroups.Demo.List<Person>("ListDemo"); await list.Delete(); await list.RightPush(new Person { Name = "Hoge", Age = 10 }); await list.Expire(TimeSpan.FromSeconds(15)); var ids = new[] { 12 };//, 3124, 51, 636, 6714 }; var rand = new Random(); // you can watch parallel execution await Task.WhenAll(ids.Select(async x => { await RedisGroups.Demo.String<int>("TestInc.Id." + x).Increment(rand.Next(1, 10)); }).ToArray()); await list.Range(0, 10); await list.Range(0, 10); var str = RedisGroups.Demo.String<int>("aaa"); await str.Set(1000); await str.Get(); await str.Delete(); await str.Get(); // it's null! return View(); }
public void CompleteTask(IDatabase db, string task, string timestamp, string responsible) { var arguments = new { taskId = task, timestamp = timestamp, responsible = responsible }; _scripts["completeTask"].Evaluate(db, arguments); }
public void FailTask(IDatabase db, string task, string timestamp) { var arguments = new { taskId = task, timestamp = timestamp }; _scripts["failTask"].Evaluate(db, arguments); }
public long? PushWorkflow(IDatabase db, string workflowJson, string timestamp) { var arguments = new { workflowJson = workflowJson, timestamp = timestamp }; var result = _scripts["pushWorkflow"].Evaluate(db, arguments); return (long?)result; }
public async System.Threading.Tasks.Task<long?> PushWorkflowAsync(IDatabase db, string workflowJson, string timestamp) { var arguments = new { workflowJson = workflowJson, timestamp = timestamp }; var result = await _scripts["pushWorkflow"].EvaluateAsync(db, arguments); return (long?)result; }
public string[] FindTasksFor(IDatabase db, string responsible) { var arguments = new { responsible = responsible }; string[] result = (string[])_scripts["listTasksForResponsibleComponent"].Evaluate(db, arguments); return result; }
public string[] ResubmitTasksFor(IDatabase db, string responsible, string timestamp) { var arguments = new { responsible = responsible, timestamp = timestamp }; string[] result = (string[])_scripts["resetTasksForResponsibleComponent"].Evaluate(db, arguments); return result; }
public string FetchWorkflowInformation(IDatabase db, string workflowId) { var arguments = new { workflowId = workflowId }; string result = (string)_scripts["fetchWorkflowInformation"].Evaluate(db, arguments); return result; }
public void PauseWorkflow(IDatabase db, string workflowId, string timestamp) { var arguments = new { workflowId = workflowId, timestamp = timestamp }; _scripts["pauseWorkflow"].Evaluate(db, arguments); }
/// <summary> /// Cleans up all entries in a workflow. Attempts to do this slightly gracefully -- any /// tasks in a running state will be moved to abandoned, so that when they complete it won't /// bring down a process. /// </summary> /// <param name="db"></param> /// <param name="workflow"></param> public void CleanupWorkflow(IDatabase db, string workflow) { var arguments = new { workflowId = workflow }; _scripts["cleanupWorkflow"].Evaluate(db, arguments); }
public string[] PopTask(IDatabase db, string type, string timestamp, string responsible) { var arguments = new { timestamp = timestamp, responsible = responsible, taskType = type, maxPriority = _lowestPriority }; var result = (string[])_scripts["popTask"].Evaluate(db, arguments); return (string.IsNullOrEmpty(result[0].ToString())) ? null : result; }