diff --git a/VERSION b/VERSION index 18537964..a4c6bea4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.0.9 (2012-09-14 15:51:53) stable +Version 2.0.9 (2012-09-14 16:08:21) stable diff --git a/gluon/cache.py b/gluon/cache.py index 23626f40..8d9c1c63 100644 --- a/gluon/cache.py +++ b/gluon/cache.py @@ -479,6 +479,17 @@ class Cache(object): return CacheAction(func,key,time_expire,self,cache_model) return tmp + @staticmethod + def with_prefix(cache_model, prefix): + """ + allow replacing cache.ram with cache.with_prefix(cache.ram,'prefix') + it will add prefix to all the cache keys used. + """ + return lambda key, f, time_expire=DEFAULT_TIME_EXPIRE, prefix=prefix:\ + cache_model(prefix + key, f, time_expire) + + + def lazy_cache(key=None,time_expire=None,cache_model='ram'): """ can be used to cache any function including in modules,