summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Andrews <candrews@integralblue.com>2010-01-04 12:49:25 -0500
committerCraig Andrews <candrews@integralblue.com>2010-01-04 12:49:25 -0500
commit7a2d72fe28e29c67f2a9e8fdb59c6c5c9b38d5e6 (patch)
treeed00b19b1d85b88e74549c0a7e152abec9c63304
parenta0f7896f22b93caedf4cfcb91b14a25c0c1e6a82 (diff)
Enable memcache automatic compression, starting at 20k and only if compression gain is greater than 20%.
Allows storage of larger objects (over 1mb in size uncompressed), such as huge LDAP schemas. Should also improve cache efficiency (allows more stuff to be stored in same memory) and reduce network latency (less data transfer) (redo commit 1e9c03e1993b5d2978ac4c5213a8a64e0150b4a2 which was apparently lost during pluginization)
-rw-r--r--plugins/MemcachePlugin.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/plugins/MemcachePlugin.php b/plugins/MemcachePlugin.php
index acbec135e..78e2b2406 100644
--- a/plugins/MemcachePlugin.php
+++ b/plugins/MemcachePlugin.php
@@ -156,6 +156,11 @@ class MemcachePlugin extends Plugin
}
$this->_conn->addServer($host, $port);
}
+ //Compress items stored in the cache if they're over 2k in size
+ //and the compression would save more than 20%.
+ //Allows the cache to store objects larger than 1MB (if they
+ //compress to less than 1MB), and improves cache memory efficiency.
+ $this->_conn->setCompressThreshold(20000, 0.2);
}
}
}