コード例 #1
0
        public SQLiteCacheHandle(
            ICacheManagerConfiguration managerConfiguration,
            CacheHandleConfiguration configuration,
            ILoggerFactory loggerFactory,
            ICacheSerializer serializer,
            SQLiteCacheHandleAdditionalConfiguration additionalConfiguration)
            : base(managerConfiguration, configuration)
        {
            this.serializer = serializer;
            this.additionalConfiguration = additionalConfiguration ?? new SQLiteCacheHandleAdditionalConfiguration();

            Logger = loggerFactory.CreateLogger(this);

            this.cacheName = configuration.Name;

            this.conn = CreateConnection(this.additionalConfiguration.DatabaseFilePath);

            if (additionalConfiguration != null)
            {
                additionalConfiguration.BeginTransactionMethod = () => this.conn.BeginTransaction(/* TODO: Support arguments/overloads */);
            }

            this.SetInitialItemCount();

            RemoveExpiredItems();
        }
コード例 #2
0
 public static ConfigurationBuilderCacheHandlePart WithSQLiteCacheHandle(
     this ConfigurationBuilderCachePart part,
     SQLiteCacheHandleAdditionalConfiguration config)
 => part?.WithHandle(
     typeof(SQLiteCacheHandle <>),
     Guid.NewGuid().ToString(),
     isBackplaneSource: false,
     config);