equal
deleted
inserted
replaced
39 def get(id, *args, **kwargs): |
39 def get(id, *args, **kwargs): |
40 """Retrieves the sidebar for the specified user from the memcache. |
40 """Retrieves the sidebar for the specified user from the memcache. |
41 """ |
41 """ |
42 |
42 |
43 memcache_key = key(id) |
43 memcache_key = key(id) |
|
44 # pylint: disable-msg=E1101 |
44 return memcache.get(memcache_key), memcache_key |
45 return memcache.get(memcache_key), memcache_key |
45 |
46 |
46 |
47 |
47 def put(sidebar, memcache_key, *args, **kwargs): |
48 def put(sidebar, memcache_key, *args, **kwargs): |
48 """Sets the sidebar for the specified user in the memcache. |
49 """Sets the sidebar for the specified user in the memcache. |
51 sidebar: the sidebar to be cached |
52 sidebar: the sidebar to be cached |
52 """ |
53 """ |
53 |
54 |
54 # Store sidebar for just three minutes to force a refresh every so often |
55 # Store sidebar for just three minutes to force a refresh every so often |
55 retention = 3*60 |
56 retention = 3*60 |
56 |
57 # pylint: disable-msg=E1101 |
57 memcache.add(memcache_key, sidebar, retention) |
58 memcache.add(memcache_key, sidebar, retention) |
58 |
59 |
59 |
60 |
60 def flush(id=None): |
61 def flush(id=None): |
61 """Removes the sidebar for the current user from the memcache. |
62 """Removes the sidebar for the current user from the memcache. |
68 |
69 |
69 if not id: |
70 if not id: |
70 id = soc.logic.accounts.getCurrentAccount() |
71 id = soc.logic.accounts.getCurrentAccount() |
71 |
72 |
72 memcache_key = key(id) |
73 memcache_key = key(id) |
|
74 # pylint: disable-msg=E1101 |
73 memcache.delete(memcache_key) |
75 memcache.delete(memcache_key) |
74 soc.cache.rights.flush(id) |
76 soc.cache.rights.flush(id) |
75 |
77 |
76 |
78 |
77 # define the cache function |
79 # define the cache function |