File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -232,6 +232,10 @@ def __init__(self):
232232 }
233233 self ._client = base .Client (host , ** self ._opts )
234234
235+ @staticmethod
236+ def _normalize_key (key ):
237+ return base64 .encodebytes (mmh3 .hash_bytes (key )).strip ()
238+
235239 def run (self ):
236240 pass
237241
@@ -240,14 +244,14 @@ def close(self):
240244
241245 def __getitem__ (self , key ):
242246 try :
243- return self ._client .get (mmh3 . hash_bytes (key ))
247+ return self ._client .get (self . _normalize_key (key ))
244248 except MemcacheError as err :
245249 log .error ("Failed to get session from memcache: %s" , err )
246250 return None
247251
248252 def __setitem__ (self , key , value ):
249253 try :
250- self ._client .set (mmh3 . hash_bytes (key ), value , expire = self .ttl )
254+ self ._client .set (self . _normalize_key (key ), value , expire = self .ttl )
251255 except MemcacheError as err :
252256 log .error ("Failed to store session in memcache: %s" , err )
253257
You can’t perform that action at this time.
0 commit comments