Пример #1
0
 public CleanupManager(CleanupManagerOptions options, ICacheDatabase database, ILogger logger, HashBasedPathBuilder pathBuilder)
 {
     PathBuilder   = pathBuilder;
     Logger        = logger;
     Options       = options;
     Database      = database;
     accessCounter = new Lazy <BucketCounter>(() => new BucketCounter(Options.AccessTrackingBits));
 }
Пример #2
0
 public AsyncCache(AsyncCacheOptions options, ICacheCleanupManager cleanupManager, HashBasedPathBuilder pathBuilder, ILogger logger)
 {
     Options            = options;
     PathBuilder        = pathBuilder;
     CleanupManager     = cleanupManager;
     Logger             = logger;
     FileWriteLocks     = new AsyncLockProvider();
     QueueLocks         = new AsyncLockProvider();
     EvictAndWriteLocks = new AsyncLockProvider();
     CurrentWrites      = new AsyncWriteCollection(options.MaxQueuedBytes);
     FileWriter         = new CacheFileWriter(FileWriteLocks, Options.MoveFileOverwriteFunc, Options.MoveFilesIntoPlace);
 }
Пример #3
0
        public HybridCache(ICacheDatabase cacheDatabase, HybridCacheOptions options, ILogger logger)
        {
            this.logger = logger;
            Database    = cacheDatabase;
            PathBuilder = new HashBasedPathBuilder(options.PhysicalCacheDir, options.Subfolders,
                                                   Path.DirectorySeparatorChar, ".jpg");
            options.CleanupManagerOptions.MoveFileOverwriteFunc = options.CleanupManagerOptions.MoveFileOverwriteFunc ??
                                                                  options.AsyncCacheOptions.MoveFileOverwriteFunc;

            CleanupManager = new CleanupManager(options.CleanupManagerOptions, Database, logger, PathBuilder);
            AsyncCache     = new AsyncCache(options.AsyncCacheOptions, CleanupManager, PathBuilder, logger);
        }