/// <summary> /// Specifies the cache TTL. Items will expire from the cache after this amount of time from the /// time when they were originally cached. /// </summary> /// <remarks> /// <para> /// If the value is <c>TimeSpan.Zero</c>, caching is disabled (equivalent to <see cref="NoCaching"/>). /// </para> /// <para> /// If the value is <c>System.Threading.Timeout.InfiniteTimeSpan</c> (or any negative number), data is /// cached forever (equivalent to <see cref="CacheForever"/>). /// </para> /// </remarks> /// <param name="cacheTime">the cache TTL</param> /// <returns>the builder</returns> public PersistentDataStoreBuilder CacheTime(TimeSpan cacheTime) { _cacheConfig = _cacheConfig.WithTtl(cacheTime); return(this); }
/// <summary> /// Specifies the maximum number of entries that can be held in the cache at a time. /// </summary> /// <remarks> /// <para> /// If this limit is exceeded, older entries will be evicted from the cache to make room /// for new ones. /// </para> /// <para> /// If this is null, there is no limit on the number of entries. /// </para> /// </remarks> /// <param name="maximumEntries">the maximum number of entries, or null for no limit</param> /// <returns>an updated factory object</returns> public PersistentDataStoreBuilder CacheMaximumEntries(int?maximumEntries) { _cacheConfig = _cacheConfig.WithMaximumEntries(maximumEntries); return(this); }