changeset 6026:28a3951fc9f6

add comments about userid lookup cache killing/rebuilding
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Wed, 12 Feb 2014 12:12:17 +0100
parents 05a6897ee496
children 8618232296b5
files MoinMoin/user.py
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/user.py	Wed Feb 12 12:07:22 2014 +0100
+++ b/MoinMoin/user.py	Wed Feb 12 12:12:17 2014 +0100
@@ -94,6 +94,10 @@
         setattr(cfg.cache, cachekey, _key2id)
     uid = _key2id.get(search, None)
     if uid is None:
+        # complete cache rebuild on a cache miss! (expensive)
+        # note: we have this code block likely because we were not sure about
+        #       cache consistency. if we can assure cache consistency, this
+        #       block wouldn't be needed.
         for userid in getUserList(request):
             u = User(request, id=userid)
             if hasattr(u, key):
@@ -113,6 +117,9 @@
 
 
 def clearUserIdLookupCaches(request):
+    """kill the userid lookup caches"""
+    # this triggers a rebuild of the cache.
+    # we maybe could rather update the caches, would be less expensive
     scope, arena = 'userdir', 'users'
     for key in ['name2id', 'openid2id', ]:
         caching.CacheEntry(request, arena, key, scope=scope).remove()