Package com.transifex.txnative.cache
Class TxDecoratorCache
java.lang.Object
com.transifex.txnative.cache.TxDecoratorCache
- All Implemented Interfaces:
TxCache
- Direct Known Subclasses:
TxFileOutputCacheDecorator,TxProviderBasedCache,TxReadonlyCacheDecorator,TxUpdateFilterCache
Decorator class managing an internal cache and propagating the get() and update() protocol method
calls to said cache. The class should be extended to add new capabilities.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTxDecoratorCache(TxCache internalCache) Creates a decorator with the provided cache. -
Method Summary
Modifier and TypeMethodDescriptionget()Gets all translations from the cache in the form of aTranslationMapobject.Get the translation for a certain key and locale pair.voidupdate(LocaleData.TranslationMap translationMap) Update the cache with the providedTranslationMap.
-
Field Details
-
mInternalCache
-
-
Constructor Details
-
TxDecoratorCache
Creates a decorator with the provided cache.- Parameters:
internalCache- The cache to be used.
-
-
Method Details
-
get
Description copied from interface:TxCacheGets all translations from the cache in the form of aTranslationMapobject.The returned object should not be altered as the cache may use it internally.
-
get
Description copied from interface:TxCacheGet the translation for a certain key and locale pair.- Specified by:
getin interfaceTxCache- Parameters:
key- The key of the string.locale- The locale code.- Returns:
- The string if the key was found in the cache;
nullif the provided locale does not exist in the cache or the key does not exist for this locale; empty string if the string has not yet been translated for this locale
-
update
Description copied from interface:TxCacheUpdate the cache with the providedTranslationMap.The translation map should not be changed after providing it to the cache, because the cache implementation may use it without making a copy.
-