Class TxMemoryCache

  • All Implemented Interfaces:

    public class TxMemoryCache
    extends Object
    implements TxCache
    A cache that holds translations in memory.
    • Constructor Detail

      • TxMemoryCache

        public TxMemoryCache()
    • Method Detail

      • get

        public String get​(@NonNull
                          String key,
                          String locale)
        Description copied from interface: TxCache
        Get the translation for a certain key and locale pair.
        Specified by:
        get in interface TxCache
        key - The key of the string.
        locale - The locale code.
        The string if the key was found in the cache; null if 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

        public void update​(@NonNull
                           LocaleData.TranslationMap translationMap)
        Description copied from interface: TxCache
        Update the cache with the provided TranslationMap.

        The translation map should not be changed after providing it to the cache, because the cache implementation may use it without making a copy.

        Specified by:
        update in interface TxCache