parler.cache module

django-parler uses caching to avoid fetching model data when it doesn’t have to.

These functions are used internally by django-parler to fetch model data. Since all calls to the translation table are routed through our model descriptor fields, cache access and expiry is rather simple to implement.

class parler.cache.IsMissing

Bases: object

parler.cache.get_cached_translated_field(instance, field_name, language_code=None, use_fallback=False)

Fetch an cached field.

parler.cache.get_cached_translation(instance, language_code=None, related_name=None, use_fallback=False)

Fetch an cached translation.

parler.cache.get_object_cache_keys(instance)

Return the cache keys associated with an object.

parler.cache.get_translation_cache_key(translated_model, master_id, language_code)

The low-level function to get the cache key for a translation.

parler.cache.is_missing(value)

Check whether the returned value indicates there is no data for the language.