Execute <TEntity>(ICloudTableQuery <TEntity> query) where TEntity : ITableEntity, new() { if (query == null) { throw new ArgumentNullException("query"); } return(await Task.Run(() => { if (cachePolicy == null) { return query.Execute(tableReference); } var cached = new CloudTableQueryCache <TEntity>(query, cachePolicy, cacheHint); return cached.Execute(tableReference); })); }
public CloudTableQueryCache(ICloudTableQuery <TEntity> query, CacheItemPolicy policy, string cacheHint) { this.query = query; this.cacheHint = cacheHint; if (policy == null) { cacheItemPolicy = new CacheItemPolicy { AbsoluteExpiration = DateTime .UtcNow .Add(TimeSpan.FromMinutes(1)) } } ; else { cacheItemPolicy = policy; } }
public CloudTableQueryCache(ICloudTableQuery <TEntity> query, CacheItemPolicy policy) : this(query, policy, string.Empty) { }
/// <summary> /// Applies a 1 minute cache /// </summary> public CloudTableQueryCache(ICloudTableQuery <TEntity> query) : this(query, null) { }