natural_key_cache package

Submodules

natural_key_cache.cache_manager

class natural_key_cache.cache_manager.NaturalKeyCacheManager(natural_keys=None, backend='default', timeout=None)[source]

Bases: django.db.models.manager.Manager

Custom model manager that allows for lookups via natural keys.

contribute_to_class(model, name)[source]

Settings applied to the model when using this manager

generate_key(**search_params)[source]

Build the cache key

get(**kwargs)[source]

Get the object.

Attempt to get the object from cache based on the natural keys. if not in cache, retrieve from database and cache the result.

post_delete(instance, **kwargs)[source]

Update cache on post delete

post_save(instance, **kwargs)[source]

Update cache on post save