/// <summary> /// Setup the context for aggressive caching. /// </summary> /// <param name="cacheDuration">Specify the aggressive cache duration</param> /// <remarks> /// aggressive caching means that we will not check the server to see whatever the response /// we provide is current or not, but will serve the information directly from the local cache /// without touching the server. /// </remarks> public IDisposable AggressivelyCacheFor(TimeSpan cacheDuration) { var disposables = shards.Select(shard => shard.AggressivelyCacheFor(cacheDuration)).ToList(); return(new DisposableAction(() => { foreach (var disposable in disposables) { disposable.Dispose(); } })); }
/// <summary> /// Opens the session. /// </summary> /// <returns></returns> public IDocumentSession OpenSession() { return(new ShardedDocumentSession(shardStrategy, shards.Select(x => x.OpenSession()).ToArray())); }