Guest User

Untitled

a guest
Jun 22nd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. Index: cache.php
  2. ===================================================================
  3. --- cache.php (revision 11714)
  4. +++ cache.php (working copy)
  5. @@ -124,6 +124,7 @@
  6. */
  7. public function add($key, $val, $compressed = false, $expire = 0) {
  8. $key = $this->normalizeKey($key);
  9. + $compressed = $this->compressed($compressed);
  10. return $this->cache->add($this->prefix.$key, $val, $compressed, $expire);
  11. }
  12.  
  13. @@ -206,6 +207,7 @@
  14. */
  15. public function replace($key, $val, $compressed = false, $expire = 0) {
  16. $key = $this->normalizeKey($key);
  17. + $compressed = $this->compressed($compressed);
  18. return $this->cache->replace($this->prefix.$key, $val, $compressed, $expire);
  19. }
  20.  
  21. @@ -222,6 +224,7 @@
  22. */
  23. public function set($key, $val, $compressed = false, $expire = 0) {
  24. $key = $this->normalizeKey($key);
  25. + $compressed = $this->compressed($compressed);
  26. return $this->cache->set($this->prefix.$key, $val, $compressed, $expire);
  27. }
  28.  
  29. @@ -258,4 +261,13 @@
  30. protected function normalizeKey($key) {
  31. return str_replace(' ', '_', $key);
  32. }
  33. +
  34. + /**
  35. + * The compressed argument on Memcache::add, Memcache::set and Memcache::replace takes
  36. + * an integer not a boolean. Since pecl/memcache 3.0.3 booleans now leads to warnings like
  37. + * The lowest two bytes of the flags array is reserved for pecl/memcache internal use
  38. + */
  39. + protected function compressed($compressed) {
  40. + return $compressed == false ? 0 : MEMCACHE_COMPRESSED;
  41. + }
  42. }
Add Comment
Please, Sign In to add comment