summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-01-04 09:09:59 -1000
committerEvan Prodromou <evan@status.net>2010-01-04 09:09:59 -1000
commitbcddcb38cebc5ffbffd3df61fb9acaf6f674b133 (patch)
tree23c064673d5cc4dd34d180769e77a61b934b3d6e /plugins
parentb5e0f7d5725d4e106cf9f4b6383e0477a597fac6 (diff)
make compression threshold and min savings config attrs for MemcachePlugin
Diffstat (limited to 'plugins')
-rw-r--r--plugins/MemcachePlugin.php18
1 files changed, 13 insertions, 5 deletions
diff --git a/plugins/MemcachePlugin.php b/plugins/MemcachePlugin.php
index 78e2b2406..998766313 100644
--- a/plugins/MemcachePlugin.php
+++ b/plugins/MemcachePlugin.php
@@ -54,6 +54,9 @@ class MemcachePlugin extends Plugin
private $_conn = null;
public $servers = array('127.0.0.1;11211');
+ public $compressThreshold = 20480;
+ public $compressMinSaving = 0.2;
+
/**
* Initialize the plugin
*
@@ -156,11 +159,16 @@ 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);
+
+ // Compress items stored in the cache if they're over threshold in size
+ // (default 2KiB) and the compression would save more than min savings
+ // ratio (default 0.2).
+
+ // Allows the cache to store objects larger than 1MB (if they
+ // compress to less than 1MB), and improves cache memory efficiency.
+
+ $this->_conn->setCompressThreshold($this->compressThreshold,
+ $this->compressMinSaving);
}
}
}