changeset 3853:3b37036d466d

cache action: add remove() function
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 14 Jul 2008 19:14:06 +0200
parents e814f653f02d
children 30240e801a55
files MoinMoin/action/cache.py
diffstat 1 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/cache.py	Mon Jul 14 17:25:57 2008 +0200
+++ b/MoinMoin/action/cache.py	Mon Jul 14 19:14:06 2008 +0200
@@ -169,6 +169,14 @@
     return meta_cached and data_cached
 
 
+def remove(request, key):
+    """ delete headers/data cache for key """
+    meta_cache = caching.CacheEntry(request, cache_arena, key+'.meta', cache_scope, do_locking=do_locking, use_pickle=True)
+    meta_cache.remove()
+    data_cache = caching.CacheEntry(request, cache_arena, key+'.data', cache_scope, do_locking=do_locking)
+    data_cache.remove()
+
+
 def url(request, key, do='get'):
     """ return URL for the object cached for key """
     return "%s/?%s" % (
@@ -200,20 +208,17 @@
         request.send_file(_get_datafile(request, key))
 
 
-def _do_del(request, key):
+def _do_remove(request, key):
     """ delete headers/data cache for key """
-    meta_cache = caching.CacheEntry(request, cache_arena, key+'.meta', cache_scope, do_locking=do_locking, use_pickle=True)
-    meta_cache.remove()
-    data_cache = caching.CacheEntry(request, cache_arena, key+'.data', cache_scope, do_locking=do_locking)
-    data_cache.remove()
+    remove(request, key)
     request.emit_http_headers(["Status: 200 OK"])
 
 
 def _do(request, do, key):
     if do == 'get':
         _do_get(request, key)
-    elif do == 'del':
-        _do_del(request, key)
+    elif do == 'remove':
+        _do_remove(request, key)
 
 def execute(pagename, request):
     do = request.form.get('do', [None])[0]