mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-04-20 05:00:59 +00:00
Add NonValidatingCacheStateBackend
This commit is contained in:
parent
164a4e11fc
commit
15b15afe2c
1 changed files with 27 additions and 0 deletions
|
|
@ -30,6 +30,33 @@ class PessimisticCacheStateBackend(object):
|
|||
file.delete(save=False)
|
||||
|
||||
|
||||
class NonValidatingCacheStateBackend(object):
|
||||
"""
|
||||
A backend that is super optimistic about the existence of spec files. It
|
||||
will hit your file storage much less frequently than the pessimistic
|
||||
backend, but it is technically possible for a cache file to be missing
|
||||
after validation.
|
||||
|
||||
"""
|
||||
|
||||
def validate(self, file):
|
||||
"""
|
||||
NonValidatingCacheStateBackend has faith, so validate's a no-op.
|
||||
|
||||
"""
|
||||
pass
|
||||
|
||||
def invalidate(self, file):
|
||||
"""
|
||||
Immediately generate a new spec file upon invalidation.
|
||||
|
||||
"""
|
||||
file.generate(save=True)
|
||||
|
||||
def clear(self, file):
|
||||
file.delete(save=False)
|
||||
|
||||
|
||||
_default_cache_state_backend = None
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue