Package com.transifex.txnative.cache
Class TxProviderBasedCache
java.lang.Object
com.transifex.txnative.cache.TxDecoratorCache
com.transifex.txnative.cache.TxProviderBasedCache
- All Implemented Interfaces:
TxCache
Composite class that accepts a number of translations providers and an internal cache. When
initialized, the providers are used to update the internal class in the order they are added in
the providers array.
Example usage:
TxCache cache = new TxProviderBasedCache( new TxDiskTranslationsProvider[]{ new TxDiskTranslationsProvider(firstTranslationsDirectory), new TxDiskTranslationsProvider(secondTranslationsDirectory)}, new TxMemoryCache());
-
Field Summary
Fields inherited from class com.transifex.txnative.cache.TxDecoratorCache
mInternalCache
-
Constructor Summary
ConstructorDescriptionTxProviderBasedCache
(TxTranslationsProvider[] providers, TxCache internalCache) Creates a provider-based cache with the given internal cache and updates it with with the contents of the given translations providers. -
Method Summary
Methods inherited from class com.transifex.txnative.cache.TxDecoratorCache
get, get, update
-
Constructor Details
-
TxProviderBasedCache
public TxProviderBasedCache(@NonNull TxTranslationsProvider[] providers, @NonNull TxCache internalCache) Creates a provider-based cache with the given internal cache and updates it with with the contents of the given translations providers.The translations providers update the internal cache in the given order. If they return a
null
or emptyLocaleData.TranslationMap
they are ignored.The providers' content is accessed synchronously in the class's constructor.
- Parameters:
providers
- An array of translations providers.internalCache
- The internal cache to be used.
-