Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Bug 761469 - memcached code cleanups; r=telliott

  • Loading branch information...
commit 202314e6ab6ca36349931a42643d2ff36b6be3ef 1 parent c9db696
Ryan Kelly authored June 07, 2012
4  syncstorage/storage/cachemanager.py
@@ -7,6 +7,8 @@
7 7
 - User tabs are stored in one single "user_id:tabs" key
8 8
 - The total storage size is stored in "user_id:size"
9 9
 - The meta/global bso is stored in "user_id"
  10
+- The last-modified time for the entire storage is stored in user_id:stamp
  11
+- The info/collections timestamp mapping is stored in user_id:stamps
10 12
 """
11 13
 import threading
12 14
 import thread
@@ -20,7 +22,7 @@
20 22
 from mozsvc.exceptions import BackendError
21 23
 
22 24
 
23  
-USER_KEYS = ('size', 'meta:global', 'tabs', 'stamps')
  25
+USER_KEYS = ('size', 'size:ts', 'meta:global', 'tabs', 'stamps', 'stamp')
24 26
 
25 27
 
26 28
 def _key(*args):
12  syncstorage/storage/memcachedsql.py
@@ -18,7 +18,7 @@
18 18
 from syncstorage.util import get_timestamp
19 19
 from syncstorage.storage.sql import SQLStorage
20 20
 from syncstorage.storage.sqlmappers import bso
21  
-from syncstorage.storage.cachemanager import CacheManager
  21
+from syncstorage.storage.cachemanager import CacheManager, _key
22 22
 
23 23
 
24 24
 # Recalculate quota if they have less than 1MB remaining.
@@ -33,10 +33,6 @@
33 33
             bso.c.userid == bindparam('user_id')).group_by(bso.c.collection)
34 34
 
35 35
 
36  
-def _key(*args):
37  
-    return ':'.join([str(arg) for arg in args])
38  
-
39  
-
40 36
 # XXX suboptimal: creates an object on every dump/load call
41 37
 # but that's how python-memcached works - using a class
42 38
 # instead of an object would not be thread-safe.
@@ -147,12 +143,6 @@ def _get_item():
147 143
 
148 144
         return _get_item()
149 145
 
150  
-    def _delete_cache(self, user_id):
151  
-        """Removes all cached data."""
152  
-        KEYS = ('size', 'size:ts', 'meta:global', 'tabs', 'stamps', 'stamp')
153  
-        for key in KEYS:
154  
-            self.cache.delete(_key(user_id, key))
155  
-
156 146
     def _update_stamp(self, user_id, collection_name, storage_time):
157 147
         # update the stamps cache
158 148
         stamps = self.get_collection_timestamps(user_id)

0 notes on commit 202314e

Please sign in to comment.
Something went wrong with that request. Please try again.