public FileSystemGangStoreFactory( IFileSystemGangStoreSettings settings, IGangSerializationService serializer, IMemoryCache cache ) { _settings = settings; _serializer = serializer; _cache = cache; }
public static IServiceCollection AddFileSystemGangStore( this IServiceCollection services, IFileSystemGangStoreSettings settings ) { services.AddSingleton <IMemoryCache>( _ => new MemoryCache(new MemoryCacheOptions()) ); services.AddSingleton(settings); services.AddGangStoreFactory <FileSystemGangStoreFactory>(); return(services); }
public FileSystemGangStore( IFileSystemGangStoreSettings settings, IGangSerializationService serializer, IMemoryCache cache, string name = null, IEnumerable <Func <TData, IEnumerable <object> > > indexers = null ) { _settings = settings; _serializer = serializer; _cache = cache; _ioTasks = new TaskQueue(); _indexers = indexers ?.ToImmutableArray() ?? ImmutableArray <Func <TData, IEnumerable <object> > > .Empty; Name = name; Directory.CreateDirectory(Path.GetDirectoryName(GetDataFilePath(null))); if (_indexers.Any()) { Directory.CreateDirectory(Path.GetDirectoryName(GetIndexFilePath(null))); } }