diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-01-08 15:18:12 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-01-08 15:18:12 +0100 |
commit | be7837402d55abc9a6dc801c943c9b642e821dd0 (patch) | |
tree | 731e0d57501dd3d89243ca0771ae38b276740844 /lib | |
parent | 4d65a8089284e4dde09181b56fb45b86c50d6fb5 (diff) | |
download | nextcloud-server-be7837402d55abc9a6dc801c943c9b642e821dd0.tar.gz nextcloud-server-be7837402d55abc9a6dc801c943c9b642e821dd0.zip |
get the memorycache factory from OCP\Server instead of a cache instance
this allows apps to specify a prefix to use
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/server.php | 11 | ||||
-rw-r--r-- | lib/public/cachefactory.php | 17 |
2 files changed, 22 insertions, 6 deletions
diff --git a/lib/private/server.php b/lib/private/server.php index 6b242bddd01..b5fa9148626 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -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'); } /** diff --git a/lib/public/cachefactory.php b/lib/public/cachefactory.php new file mode 100644 index 00000000000..bb49aea7f3a --- /dev/null +++ b/lib/public/cachefactory.php @@ -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 = ''); +} |