Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FileCacheHandle{TCacheValue}"/> class.
        /// </summary>
        /// <param name="managerConfiguration">The manager configuration.</param>
        /// <param name="configuration">The cache handle configuration.</param>
        /// <param name="loggerFactory">The logger factory.</param>
        /// <param name="additionalConfiguration">The FileCache additional configuration.</param>
        public FileCacheHandle(ICacheManagerConfiguration managerConfiguration, CacheHandleConfiguration configuration, ILoggerFactory loggerFactory, FileCacheHandleAdditionalConfiguration additionalConfiguration)
            : base(managerConfiguration, configuration)
        {
            NotNull(configuration, nameof(configuration));
            NotNull(loggerFactory, nameof(loggerFactory));

            Logger     = loggerFactory.CreateLogger(this);
            _cacheName = configuration.Name ?? DefaultCacheName;

            if (additionalConfiguration == null)
            {
                additionalConfiguration = new FileCacheHandleAdditionalConfiguration();
            }

            if (additionalConfiguration.SerializationBinder == null)
            {
                _cache = new FileCache(_cacheName, additionalConfiguration.CalculateCacheSize, additionalConfiguration.CleanInterval);
            }
            else
            {
                _cache = new FileCache(_cacheName, additionalConfiguration.SerializationBinder, additionalConfiguration.CalculateCacheSize, additionalConfiguration.CleanInterval);
            }
        }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FileCacheHandle{TCacheValue}"/> class.
 /// </summary>
 /// <param name="managerConfiguration">The manager configuration.</param>
 /// <param name="configuration">The cache handle configuration.</param>
 /// <param name="loggerFactory">The logger factory.</param>
 /// <param name="serializer">The serializer.</param>
 /// <param name="additionalConfiguration">The FileCache additional configuration.</param>
 public FileCacheHandle(ICacheManagerConfiguration managerConfiguration, CacheHandleConfiguration configuration, ILoggerFactory loggerFactory, ICacheSerializer serializer, FileCacheHandleAdditionalConfiguration additionalConfiguration)
     : this(managerConfiguration, configuration, loggerFactory, additionalConfiguration)
 {
     NotNull(serializer, nameof(serializer));
     _serializer = serializer;
 }