changeset 6024:ad461ba29a17

getSubscribers: fix: move the cache to "userdir" scope, update cleancache script Moving to "userdir" scope avoids issues by storing the cache with the user profiles. See also comment of previous commit. moin maint cleancache now also cleans the "userdir" scope cache.
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Wed, 12 Feb 2014 01:15:00 +0100
parents 7e3e406f21d9
children 05a6897ee496
files MoinMoin/Page.py MoinMoin/script/maint/cleancache.py MoinMoin/user.py
diffstat 3 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/Page.py	Tue Feb 11 16:18:47 2014 +0100
+++ b/MoinMoin/Page.py	Wed Feb 12 01:15:00 2014 +0100
@@ -899,16 +899,15 @@
         # add current page name for list matching
         pageList.append(self.page_name)
 
-        arena = 'user'
-        key = 'page_sub'
+        scope, arena, key = 'userdir', 'users', 'pagesubscriptions'
 
         # get or create cache file
-        cache = caching.CacheEntry(request, arena, key, scope='wiki', use_pickle=True)
+        cache = caching.CacheEntry(request, arena, key, scope=scope, use_pickle=True)
         if cache.exists():
             page_sub = cache.content()
         else:
             # build a cache if it doesn't exist
-            cache = caching.CacheEntry(request, arena, key, scope='wiki', use_pickle=True, do_locking=False)
+            cache = caching.CacheEntry(request, arena, key, scope=scope, use_pickle=True, do_locking=False)
             # lock to stop anybody else interfering with the data while we're working
             cache.lock('w')
             userlist = user.getUserList(request)
--- a/MoinMoin/script/maint/cleancache.py	Tue Feb 11 16:18:47 2014 +0100
+++ b/MoinMoin/script/maint/cleancache.py	Wed Feb 12 01:15:00 2014 +0100
@@ -15,8 +15,11 @@
     """\
 Purpose:
 ========
-This script allows you to globally delete all the cache files in data/pages/PageName/cache/
-and /data/cache directories
+This script allows you to globally delete all the cache files in the directories:
+
+* <data_dir>/pages/PageName/cache/
+* <data_dir>/cache
+* <user_dir>/cache
 
 You will usually do this after changing MoinMoin code, by either upgrading
 version, installing or removing macros or changing the regex expression for dicts or groups.
@@ -60,6 +63,7 @@
         # clean dict and groups related cache
         arena_scope_list =  [('pagedicts', 'wiki'),
                              ('pagegroups', 'wiki'),
+                             ('users', 'userdir'),
         ]
         for arena, scope in arena_scope_list:
             for key in caching.get_cache_list(request, arena, scope):
--- a/MoinMoin/user.py	Tue Feb 11 16:18:47 2014 +0100
+++ b/MoinMoin/user.py	Wed Feb 12 01:15:00 2014 +0100
@@ -901,11 +901,10 @@
         page subscriber's cache
         """
 
-        arena = 'user'
-        key = 'page_sub'
+        scope, arena, key = 'userdir', 'users', 'pagesubscriptions'
 
         page_sub = {}
-        cache = caching.CacheEntry(self._request, arena, key, scope='wiki', use_pickle=True, do_locking=False)
+        cache = caching.CacheEntry(self._request, arena=arena, key=key, scope=scope, use_pickle=True, do_locking=False)
         if not cache.exists():
             return  # if no cache file exists, just don't do anything