mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-03-16 21:30:23 +00:00
Rename Pessimistic to JustInTime
This commit is contained in:
parent
ca391fbf0a
commit
7f6e97a37a
2 changed files with 6 additions and 11 deletions
|
|
@ -7,7 +7,7 @@ class ImageKitConf(AppConf):
|
|||
CACHE_BACKEND = None
|
||||
CACHE_DIR = 'CACHE/images'
|
||||
CACHE_PREFIX = 'imagekit:'
|
||||
DEFAULT_IMAGE_CACHE_STRATEGY = 'imagekit.imagecache.strategies.Pessimistic'
|
||||
DEFAULT_IMAGE_CACHE_STRATEGY = 'imagekit.imagecache.strategies.JustInTime'
|
||||
|
||||
def configure_cache_backend(self, value):
|
||||
if value is None:
|
||||
|
|
|
|||
|
|
@ -2,26 +2,21 @@ from .actions import validate_now, clear_now
|
|||
from ..utils import get_singleton
|
||||
|
||||
|
||||
class Pessimistic(object):
|
||||
class JustInTime(object):
|
||||
"""
|
||||
A caching strategy that validates the file every time it's accessed.
|
||||
A caching strategy that validates the file right before it's needed.
|
||||
|
||||
"""
|
||||
|
||||
def on_accessed(self, file):
|
||||
validate_now(file)
|
||||
|
||||
def on_source_deleted(self, file):
|
||||
clear_now(file)
|
||||
|
||||
def on_source_changed(self, file):
|
||||
validate_now(file)
|
||||
|
||||
|
||||
class Optimistic(object):
|
||||
"""
|
||||
A caching strategy that validates when the source file changes and assumes
|
||||
that the cached file will persist.
|
||||
A caching strategy that acts immediately when the source file chages and
|
||||
assumes that the cache files will not be removed (i.e. doesn't revalidate
|
||||
on access).
|
||||
|
||||
"""
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue