summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Save <savetheinternet@tinyboard.org>2012-02-14 23:36:08 +1100
committerMichael Save <savetheinternet@tinyboard.org>2012-02-14 23:36:08 +1100
commite3f322e2135b6010e7c89a27122b96584acfd1a5 (patch)
tree89b3b2700aebd3050380ae456ca076522905753b
parenta431994016e0293112a8e3b40832eeec09dafbdf (diff)
optional cache prefix for multiple tinyboard instances on one machine
-rw-r--r--inc/cache.php6
-rw-r--r--inc/config.php3
2 files changed, 9 insertions, 0 deletions
diff --git a/inc/cache.php b/inc/cache.php
index cc0624e4..cc3f4be0 100644
--- a/inc/cache.php
+++ b/inc/cache.php
@@ -17,6 +17,8 @@
public static function get($key) {
global $config, $debug;
+ $key = $config['cache']['prefix'] . $key;
+
$data = false;
switch($config['cache']['enabled']) {
case 'memcached':
@@ -45,6 +47,8 @@
public static function set($key, $value, $expires = false) {
global $config;
+ $key = $config['cache']['prefix'] . $key;
+
if(!$expires)
$expires = $config['cache']['timeout'];
@@ -68,6 +72,8 @@
public static function delete($key) {
global $config;
+ $key = $config['cache']['prefix'] . $key;
+
switch($config['cache']['enabled']) {
case 'memcached':
if(!self::$cache)
diff --git a/inc/config.php b/inc/config.php
index 837b5467..3dd770ab 100644
--- a/inc/config.php
+++ b/inc/config.php
@@ -120,6 +120,9 @@
// Timeout for cached objects such as posts and HTML
$config['cache']['timeout'] = 43200; // 12 hours
+ // Optional prefix if you're running multiple Tinyboard instances on the same machine
+ $config['cache']['prefix'] = '';
+
// Memcached servers to use - http://www.php.net/manual/en/memcached.addservers.php
$config['cache']['memcached'] = Array(
Array('localhost', 11211)