Skip to content
Snippets Groups Projects
Commit be783740 authored by Robin Appelman's avatar Robin Appelman
Browse files

get the memorycache factory from OCP\Server instead of a cache instance

this allows apps to specify a prefix to use
parent 4d65a808
No related branches found
No related tags found
No related merge requests found
......@@ -136,10 +136,9 @@ class Server extends SimpleContainer implements IServerContainer {
$this->registerService('UserCache', function($c) {
return new UserCache();
});
$this->registerService('MemCache', function ($c) {
$this->registerService('MemCacheFactory', function ($c) {
$instanceId = \OC_Util::getInstanceId();
$factory = new \OC\Memcache\Factory($instanceId);
return $factory->create();
return new \OC\Memcache\Factory($instanceId);
});
$this->registerService('ActivityManager', function($c) {
return new ActivityManager();
......@@ -303,10 +302,10 @@ class Server extends SimpleContainer implements IServerContainer {
/**
* Returns an ICache instance
*
* @return \OCP\ICache
* @return \OCP\CacheFactory
*/
function getMemCache() {
return $this->query('MemCache');
function getMemCacheFactory() {
return $this->query('MemCacheFactory');
}
/**
......
<?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 = '');
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment