memchache: use prefix string instead of global flag

remotes/origin/stable6
Robin Appelman 12 years ago
parent d82c1dfcab
commit 69048ab71f
  1. 11
      lib/memcache/apc.php
  2. 15
      lib/memcache/cache.php
  3. 9
      lib/memcache/memcached.php
  4. 9
      lib/memcache/xcache.php

@ -9,15 +9,6 @@
namespace OC\Memcache;
class APC extends Cache {
protected $prefix;
public function __construct($global = false) {
$this->prefix = \OC_Util::getInstanceId() . '/';
if (!$global) {
$this->prefix .= \OC_User::getUser() . '/';
}
}
/**
* entries in APC gets namespaced to prevent collisions between owncloud instances and users
*/
@ -61,7 +52,7 @@ class APC extends Cache {
return false;
} elseif (!ini_get('apc.enable_cli') && \OC::$CLI) {
return false;
}else{
} else {
return true;
}
}

@ -9,12 +9,21 @@
namespace OC\Memcache;
abstract class Cache {
/**
* @var string $prefix
*/
protected $prefix;
/**
* @param bool $global
* @param string $prefix
*/
abstract public function __construct($global);
public function __construct($prefix = '') {
$this->prefix = \OC_Util::getInstanceId() . '/' . $prefix;
}
public function getPrefix() {
return $this->prefix;
}
/**
* @param string $key

@ -9,18 +9,13 @@
namespace OC\Memcache;
class Memcached extends Cache {
protected $prefix;
/**
* @var \Memcached $cache
*/
private static $cache = null;
public function __construct($global = false) {
$this->prefix = \OC_Util::getInstanceId() . '/';
if (!$global) {
$this->prefix .= \OC_User::getUser() . '/';
}
public function __construct($prefix = '') {
parent::__construct($prefix);
if (is_null(self::$cache)) {
self::$cache = new \Memcached();
list($host, $port) = \OC_Config::getValue('memcached_server', array('localhost', 11211));

@ -9,15 +9,6 @@
namespace OC\Memcache;
class XCache extends Cache {
protected $prefix;
public function __construct($global = false) {
$this->prefix = \OC_Util::getInstanceId().'/';
if (!$global) {
$this->prefix .= \OC_User::getUser().'/';
}
}
/**
* entries in XCache gets namespaced to prevent collisions between owncloud instances and users
*/

Loading…
Cancel
Save