public InMemoryAssetsLevel2Cache(InMemoryCacheConfiguration configuration, MemoryCachableAssetsActionsPerformer <TAsset> entityActionsPerformer) { _configuration = configuration; _entityActionsPerformer = entityActionsPerformer; _activeTree = new Dictionary <TQuery, ReferenceCountedAsset>(); }
public static ILevel2AssetsCache <TQuery, TAsset> CreateLevel2AssetsCache <TQuery, TAsset>(CachingConfiguration cachingConfiguration, InMemoryCacheConfiguration inMemoryCacheConfiguration, MemoryCachableAssetsActionsPerformer <TAsset> entityActionsPerformer, IAssetCachingFileManager <TQuery, TAsset> fileManager) where TQuery : IFromQueryFilenameProvider where TAsset : class { var inMemoryAssetsLevel2Cache = new InMemoryAssetsLevel2Cache <TQuery, TAsset>(inMemoryCacheConfiguration, entityActionsPerformer); if (!cachingConfiguration.UseFileCaching) { return(inMemoryAssetsLevel2Cache); } else { return(new TwoStorageOverseeingLevel2Cache <TQuery, TAsset>(new InFilesAssetsCache <TQuery, TAsset>(fileManager), inMemoryAssetsLevel2Cache, cachingConfiguration.SaveAssetsToFile)); } }