internal PersistentDataStoreBuilder(IPersistentDataStoreAsyncFactory coreAsyncFactory) { _coreFactory = null; _coreAsyncFactory = coreAsyncFactory; }
/// <summary> /// Sets the storage implementation. /// </summary> /// <remarks> /// By default, the SDK uses a persistence mechanism that is specific to each platform: on Android and /// iOS it is the native preferences store, and in the .NET Standard implementation for desktop apps /// it is the <c>System.IO.IsolatedStorage</c> API. You may use this method to specify a custom /// implementation using a factory object. /// </remarks> /// <param name="persistentDataStoreFactory">a factory for the custom storage implementation, or /// <see langword="null"/> to use the default implementation</param> /// <returns>the builder</returns> public PersistenceConfigurationBuilder Storage(IPersistentDataStoreFactory persistentDataStoreFactory) { _storeFactory = persistentDataStoreFactory; return(this); }
/// <summary> /// Returns a configurable factory for a persistent data store. /// </summary> /// <remarks> /// <para> /// This method takes an <see cref="IPersistentDataStoreFactory"/> that is provided by /// some persistent data store implementation (i.e. a database integration), and converts /// it to a <see cref="PersistentDataStoreBuilder"/> which can be used to add /// caching behavior. You can then pass the <see cref="PersistentDataStoreBuilder"/> /// object to <see cref="ConfigurationBuilder.DataStore(IDataStoreFactory)"/> to use this /// configuration in the SDK. Example usage: /// </para> /// <code> /// var myStore = Components.PersistentDataStore(Redis.FeatureStore()) /// .CacheTtl(TimeSpan.FromSeconds(45)); /// var config = Configuration.Builder(sdkKey) /// .DataStore(myStore) /// .Build(); /// </code> /// <para> /// The method is overloaded because some persistent data store implementations /// use <see cref="IPersistentDataStoreFactory"/> while others use /// <see cref="IPersistentDataStoreAsyncFactory"/>. /// </para> /// </remarks> /// <param name="storeFactory">the factory for the underlying data store</param> /// <returns>a <see cref="PersistentDataStoreBuilder"/></returns> public static PersistentDataStoreBuilder PersistentDataStore(IPersistentDataStoreFactory storeFactory) { return(new PersistentDataStoreBuilder(storeFactory)); }