예제 #1
0
        public LightweightCache <List <ActiveOperation> > GetActiveOperations(ActiveSearchOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options), "Active Operations requires options");
            }

            return(TimedCache("ActiveOperations-" + options.GetHashCode().ToString(),
                              conn => conn.Query <WhoIsActiveRow>(options.ToSQLQuery(), options, commandTimeout: 300)
                              .Select(row => new ActiveOperation(row))
                              .ToList(),
                              10.Seconds(), 5.Minutes()));
        }
예제 #2
0
        public Cache <List <ActiveOperation> > GetActiveOperations(ActiveSearchOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options), "Active Operations requires options");
            }

            return(Cache <List <ActiveOperation> > .WithKey(GetCacheKey("ActiveOperations-" + options.GetHashCode().ToString()),
                                                            UpdateFromSql(nameof(GetActiveOperations),
                                                                          async conn => (await conn.QueryAsync <WhoIsActiveRow>(options.ToSQLQuery(), options, commandTimeout: 300).ConfigureAwait(false))
                                                                          .Select(row => new ActiveOperation(row))
                                                                          .ToList()),
                                                            10, 5 * 60));
        }
        public Cache<List<ActiveOperation>> GetActiveOperations(ActiveSearchOptions options)
        {
            if (options == null)
                throw new ArgumentNullException("options", "Active Operations requires options");

            return new Cache<List<ActiveOperation>>
                {
                    CacheKey = GetCacheKey("ActiveOperations-" + options.GetHashCode()),
                    CacheForSeconds = 5,
                    CacheStaleForSeconds = 5*60,
                    UpdateCache = UpdateFromSql("ActiveOperations", conn => conn.Query<WhoIsActiveRow>(options.ToSQLQuery(), options)
                                                                                .Select(row => new ActiveOperation(row))
                                                                                .ToList())
                };
        }
예제 #4
0
        public Cache <List <ActiveOperation> > GetActiveOperations(ActiveSearchOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options), "Active Operations requires options");
            }

            return(new Cache <List <ActiveOperation> >
            {
                CacheKey = GetCacheKey("ActiveOperations-" + options.GetHashCode()),
                CacheForSeconds = 5,
                CacheStaleForSeconds = 5 * 60,
                UpdateCache = UpdateFromSql("ActiveOperations", conn => conn.Query <WhoIsActiveRow>(options.ToSQLQuery(), options, commandTimeout: 300)
                                            .Select(row => new ActiveOperation(row))
                                            .ToList())
            });
        }