get the memorycache factory from OCP\Server instead of a cache instance
this allows apps to specify a prefix to use
This commit is contained in:
parent
4d65a80892
commit
be7837402d
2 changed files with 22 additions and 6 deletions
|
@ -136,10 +136,9 @@ class Server extends SimpleContainer implements IServerContainer {
|
||||||
$this->registerService('UserCache', function($c) {
|
$this->registerService('UserCache', function($c) {
|
||||||
return new UserCache();
|
return new UserCache();
|
||||||
});
|
});
|
||||||
$this->registerService('MemCache', function ($c) {
|
$this->registerService('MemCacheFactory', function ($c) {
|
||||||
$instanceId = \OC_Util::getInstanceId();
|
$instanceId = \OC_Util::getInstanceId();
|
||||||
$factory = new \OC\Memcache\Factory($instanceId);
|
return new \OC\Memcache\Factory($instanceId);
|
||||||
return $factory->create();
|
|
||||||
});
|
});
|
||||||
$this->registerService('ActivityManager', function($c) {
|
$this->registerService('ActivityManager', function($c) {
|
||||||
return new ActivityManager();
|
return new ActivityManager();
|
||||||
|
@ -303,10 +302,10 @@ class Server extends SimpleContainer implements IServerContainer {
|
||||||
/**
|
/**
|
||||||
* Returns an ICache instance
|
* Returns an ICache instance
|
||||||
*
|
*
|
||||||
* @return \OCP\ICache
|
* @return \OCP\CacheFactory
|
||||||
*/
|
*/
|
||||||
function getMemCache() {
|
function getMemCacheFactory() {
|
||||||
return $this->query('MemCache');
|
return $this->query('MemCacheFactory');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
17
lib/public/cachefactory.php
Normal file
17
lib/public/cachefactory.php
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
|
||||||
|
* This file is licensed under the Affero General Public License version 3 or
|
||||||
|
* later.
|
||||||
|
* See the COPYING-README file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace OCP;
|
||||||
|
|
||||||
|
interface CacheFactory{
|
||||||
|
/**
|
||||||
|
* @param string $prefix
|
||||||
|
* @return $return \OCP\ICache
|
||||||
|
*/
|
||||||
|
public function create($prefix = '');
|
||||||
|
}
|
Loading…
Reference in a new issue