diff --git a/imagekit/conf.py b/imagekit/conf.py index e99cfcd..d183f00 100644 --- a/imagekit/conf.py +++ b/imagekit/conf.py @@ -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: diff --git a/imagekit/imagecache/strategies.py b/imagekit/imagecache/strategies.py index e44929a..f134673 100644 --- a/imagekit/imagecache/strategies.py +++ b/imagekit/imagecache/strategies.py @@ -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). """