internal PersistentStoreWrapper( IPersistentDataStoreAsync coreAsync, DataStoreCacheConfig caching, IDataStoreUpdates dataStoreUpdates, TaskExecutor taskExecutor, Logger log ) : this(new PersistentStoreAsyncAdapter(coreAsync), caching, dataStoreUpdates, taskExecutor, log) { }
internal PersistentStoreWrapper( IPersistentDataStore core, DataStoreCacheConfig caching, IDataStoreUpdates dataStoreUpdates, TaskExecutor taskExecutor, Logger log ) { this._core = core; this._caching = caching; this._dataStoreUpdates = dataStoreUpdates; this._log = log; _cacheIndefinitely = caching.IsEnabled && caching.IsInfiniteTtl; if (caching.IsEnabled) { var itemCacheBuilder = Caches.KeyValue <CacheKey, ItemDescriptor?>() .WithLoader(GetInternalForCache) .WithMaximumEntries(caching.MaximumEntries); var allCacheBuilder = Caches.KeyValue <DataKind, ImmutableDictionary <string, ItemDescriptor> >() .WithLoader(GetAllAndDeserialize); var initCacheBuilder = Caches.SingleValue <bool>() .WithLoader(_core.Initialized); if (!caching.IsInfiniteTtl) { itemCacheBuilder.WithExpiration(caching.Ttl); allCacheBuilder.WithExpiration(caching.Ttl); initCacheBuilder.WithExpiration(caching.Ttl); } _itemCache = itemCacheBuilder.Build(); _allCache = allCacheBuilder.Build(); _initCache = initCacheBuilder.Build(); } else { _itemCache = null; _allCache = null; _initCache = null; } _statusManager = new PersistentDataStoreStatusManager( !_cacheIndefinitely, true, this.PollAvailabilityAfterOutage, dataStoreUpdates.UpdateStatus, taskExecutor, log ); }
/// <inheritdoc/> public IDataStore CreateDataStore(LdClientContext context, IDataStoreUpdates dataStoreUpdates) { if (_coreFactory != null) { return(new PersistentStoreWrapper( _coreFactory.CreatePersistentDataStore(context), _cacheConfig, dataStoreUpdates, context.TaskExecutor, context.Basic.Logger )); } else if (_coreAsyncFactory != null) { return(new PersistentStoreWrapper( _coreAsyncFactory.CreatePersistentDataStore(context), _cacheConfig, dataStoreUpdates, context.TaskExecutor, context.Basic.Logger )); } return(null); }
public IDataStore CreateDataStore(LdClientContext context, IDataStoreUpdates _) => new InMemoryDataStore();
IDataStore IDataStoreFactory.CreateDataStore(LdClientContext context, IDataStoreUpdates _) => _store;
public IDataStore CreateDataStore(LdClientContext context, IDataStoreUpdates dataStoreUpdates) { Context = context; DataStoreUpdates = dataStoreUpdates; return(_factory.CreateDataStore(context, dataStoreUpdates)); }
public IDataStore CreateDataStore(LdClientContext context, IDataStoreUpdates updateSink) => Instance;
public IDataStore CreateDataStore(LdClientContext context, IDataStoreUpdates dataStoreUpdates) => Components.InMemoryDataStore.CreateDataStore(context, dataStoreUpdates);