Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. self.mc = pylibmc.Client(
  2. servers=[os.environ.get(MEMCACHE_SERVER_VAR)],
  3. username=os.environ.get(MEMCACHE_USER_VAR),
  4. password=os.environ.get(MEMCACHE_PASS_VAR),
  5. binary=True
  6. )
  7.  
  8. #...
  9.  
  10. if (self.mc != None):
  11. self.mc.set(key, stored_data)
  12.  
  13. #...
  14.  
  15. page = self.mc.get(key)
  16.  
  17. mc = pylibmc.Client(
  18. servers=[os.environ.get(MEMCACHE_SERVER_VAR)],
  19. username=os.environ.get(MEMCACHE_USER_VAR),
  20. password=os.environ.get(MEMCACHE_PASS_VAR),
  21. binary=True
  22. )
  23. self.pool = pylibmc.ThreadMappedPool(mc)
  24.  
  25. #...
  26.  
  27. if (self.pool != None):
  28. with self.pool.reserve() as mc:
  29. mc.set(key, stored_data)
  30.  
  31. #...
  32.  
  33. if (self.pool != None):
  34. with self.pool.reserve() as mc:
  35. page = mc.get(key)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement