コード例 #1
0
 public static ConfigurationBuilderCacheHandlePart WithSQLiteCacheHandle(
     this ConfigurationBuilderCachePart part,
     SQLiteCacheHandleAdditionalConfiguration config)
 => part?.WithHandle(
     typeof(SQLiteCacheHandle <>),
     Guid.NewGuid().ToString(),
     isBackplaneSource: false,
     config);
コード例 #2
0
 public static ConfigurationBuilderCacheHandlePart WithParentCache <TCacheValue>(this ConfigurationBuilderCachePart config, ParentCache <TCacheValue> parent)
 => config.WithHandle(typeof(ParentCacheHandle <>), "PraentCache", false, parent);
コード例 #3
0
        /// <summary>
        /// Adds a <see cref="RedisCacheHandle{TCacheValue}"/>.
        /// This handle requires a redis configuration to be defined with the given <paramref name="redisConfigurationKey"/>.
        /// </summary>
        /// <param name="part">The builder instance.</param>
        /// <param name="redisConfigurationKey">
        /// The redis configuration key will be used to find a matching redis connection configuration.
        /// </param>
        /// <param name="isBackplaneSource">
        /// Set this to true if this cache handle should be the source of the backplane.
        /// This setting will be ignored if no backplane is configured.
        /// </param>
        /// <returns>The builder instance.</returns>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="redisConfigurationKey"/> is null.</exception>
        public static ConfigurationBuilderCacheHandlePart WithRedisCacheHandle(this ConfigurationBuilderCachePart part, string redisConfigurationKey, bool isBackplaneSource = true)
        {
            Guard.NotNull(part, nameof(part));

            return(part.WithHandle(typeof(RedisCacheHandle <>), redisConfigurationKey, isBackplaneSource));
        }
コード例 #4
0
 /// <summary>
 /// Adds a <see cref="MemoryCacheHandle{TCacheValue}" /> using a <see cref="MemoryCache"/> instance with the given <paramref name="instanceName"/>.
 /// The named cache instance can be configured via <c>app/web.config</c> <c>system.runtime.caching</c> section.
 /// </summary>
 /// <param name="part">The builder part.</param>
 /// <param name="instanceName">The name to be used for the cache instance.</param>
 /// <param name="isBackplaneSource">Set this to true if this cache handle should be the source of the backplane.
 /// This setting will be ignored if no backplane is configured.</param>
 /// <returns>
 /// The builder part.
 /// </returns>
 /// <exception cref="System.ArgumentNullException">If part is null.</exception>
 /// <exception cref="ArgumentNullException">Thrown if <paramref name="instanceName"/> is null.</exception>
 public static ConfigurationBuilderCacheHandlePart WithMemoryCacheHandle(this ConfigurationBuilderCachePart part, string instanceName, bool isBackplaneSource = false) => part?.WithHandle(typeof(MemoryCacheHandle <>), instanceName, isBackplaneSource);