Package com.transifex.txnative.cache
Annotation Type TxUpdateFilterCache.TxCacheUpdatePolicy
- Enclosing class:
- TxUpdateFilterCache
Update policy that specifies the way that the internal cache is updated with new
translations.
You can find an easy to understand table containing a number of cases and how each policy updates the cache below:
| Key || Cache | New || Replace All | Update using Translated |
|-----||-------|------||---------------|--------------------------------|
| a || "a" | - || - | "a" |
| b || "b" | "B" || "B" | "B" |
| c || "c" | "" || "" | "c" |
| d || "" | - || - | "" |
| e || "" | "E" || "E" | "E" |
| f || - | "F" || "F" | "F" |
| g || - | "" || "" | - |
Here's an example on how to read the table above:
- given a string with
key="c"
- and a cache that has
"c"
as the stored value for this key ("c" -> "c"
) - if an empty translation arrives for this string (
""
)- if policy is
REPLACE_ALL
, then the cache will be updated so that ("c" -> ""
) - in contrast to that, if policy is
UPDATE_USING_TRANSLATED
, then the cache will stay as is ("c" -> "c"
), because the new translation is empty
- if policy is
"-"
value means that the respective key does not exist. For example:
- given a string with
key="f"
- and a cache that has no entry with
"f"
as a key - if a translation arrives for this string (
"f" -> "F"
)- if policy is
REPLACE_ALL
, then the cache will be updated by adding a new entry so that ("f" -> "F"
) - if policy is
UPDATE_USING_TRANSLATED
, then the same will happen, since the new translation is not empty
- if policy is
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Discards the existing cache entries completely and populates the cache with the new entries, even if they contain empty translations.static final int
Updates the existing cache with the new entries that have a non-empty translation.
-
Field Details
-
REPLACE_ALL
static final int REPLACE_ALLDiscards the existing cache entries completely and populates the cache with the new entries, even if they contain empty translations.- See Also:
-
UPDATE_USING_TRANSLATED
static final int UPDATE_USING_TRANSLATEDUpdates the existing cache with the new entries that have a non-empty translation.- See Also:
-