From 7f6e97a37a55ad0ff8a0e9210f8073a809d036fb Mon Sep 17 00:00:00 2001 From: Matthew Tretter Date: Tue, 16 Oct 2012 21:46:23 -0400 Subject: [PATCH] Rename Pessimistic to JustInTime --- imagekit/conf.py | 2 +- imagekit/imagecache/strategies.py | 15 +++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) 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). """