コード例 #1
0
        private static long CreateExpirationEntry(SessionWrapper session, DateTime?expireAt)
        {
            session.DeleteAll <_AggregatedCounter>();
            var a = new _AggregatedCounter {
                Key = "key", Value = 1, ExpireAt = expireAt
            };

            session.Insert(a);
            session.Flush();
            return(a.Id);
        }
コード例 #2
0
        public static _Job InsertNewJob(SessionWrapper session, Action <_Job> action = null)
        {
            var newJob = new _Job
            {
                InvocationData = string.Empty,
                Arguments      = string.Empty,
                CreatedAt      = session.Storage.UtcNow
            };

            action?.Invoke(newJob);
            session.Insert(newJob);
            session.Flush();
            return(newJob);
        }
コード例 #3
0
        public void Enqueue(SessionWrapper session, string queue, string jobId)
        {
            var converter = StringToInt32Converter.Convert(jobId);

            if (!converter.Valid)
            {
                return;
            }
            session.Insert(new _JobQueue
            {
                Job   = session.Query <_Job>().SingleOrDefault(i => i.Id == converter.Value),
                Queue = queue
            });
            session.Flush();
            Logger.InfoFormat("Enqueued JobId={0} Queue={1}", jobId, queue);
        }