Mercurial > moin > 1.9
comparison MoinMoin/_tests/__init__.py @ 6028:1893da1d5213
userid lookup caches: use 1 on-disk cache file, update cache rather than rebuild
Before this, we maintained one cache file per attribute (e.g. name2id, openid2id,
...) - the related code did multiple passes over all user profiles to rebuild these
cache files.
Now doing a one-pass rebuild, writing all attribute -> userid mappings into
one on-disk cache file called "lookup".
Additionally to "name" and "openids", support fast lookup for "email" and "jid" also.
On profile save, we use to just kill the cache and let it rebuild. Now the cache
is read, updated and written back (which is much less expensive for wikis with more
than a few users).
Did some refactoring also, reducing duplication, breaking down the code into smaller
functions / methods.
author | Thomas Waldmann <tw AT waldmann-edv DOT de> |
---|---|
date | Wed, 12 Feb 2014 18:22:10 +0100 |
parents | 05a6897ee496 |
children |
comparison
equal
deleted
inserted
replaced
6027:8618232296b5 | 6028:1893da1d5213 |
---|---|
58 user_dir = request.cfg.user_dir | 58 user_dir = request.cfg.user_dir |
59 user_id = user.getUserId(request, username) | 59 user_id = user.getUserId(request, username) |
60 # really get rid of the user | 60 # really get rid of the user |
61 fpath = os.path.join(user_dir, user_id) | 61 fpath = os.path.join(user_dir, user_id) |
62 os.remove(fpath) | 62 os.remove(fpath) |
63 user.clearUserIdLookupCaches(request) | 63 user.clearLookupCaches(request) |
64 | 64 |
65 # Creating and destroying test pages -------------------------------- | 65 # Creating and destroying test pages -------------------------------- |
66 | 66 |
67 def create_page(request, pagename, content, do_editor_backup=False): | 67 def create_page(request, pagename, content, do_editor_backup=False): |
68 """ create a page with some content """ | 68 """ create a page with some content """ |