equal
deleted
inserted
replaced
39 def get(id, user): |
39 def get(id, user): |
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 return memcache.get(memcache_key) |
44 return memcache.get(memcache_key), memcache_key |
45 |
45 |
46 |
46 |
47 def put(sidebar, id, user): |
47 def put(sidebar, memcache_key, id, user): |
48 """Sets the sidebar for the specified user in the memcache. |
48 """Sets the sidebar for the specified user in the memcache. |
49 |
49 |
50 Args: |
50 Args: |
51 sidebar: the sidebar to be cached |
51 sidebar: the sidebar to be cached |
52 """ |
52 """ |
53 |
53 |
54 # Store sidebar for ten minutes since new programs might get added |
54 # Store sidebar for just three minutes to force a refresh every so often |
55 retention = 3*60 |
55 retention = 3*60 |
56 |
56 |
57 memcache_key = key(id) |
|
58 memcache.add(memcache_key, sidebar, retention) |
57 memcache.add(memcache_key, sidebar, retention) |
59 |
58 |
60 |
59 |
61 def flush(id=None): |
60 def flush(id=None): |
62 """Removes the sidebar for the current user from the memcache. |
61 """Removes the sidebar for the current user from the memcache. |