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())); }
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()) }; }
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()) }); }