diff options
author | Markus Goetz <markus@woboq.com> | 2013-08-17 16:01:37 +0200 |
---|---|---|
committer | Markus Goetz <markus@woboq.com> | 2013-08-18 12:29:43 +0200 |
commit | aba64a0b81853dd3153da708538dddc96bbe647d (patch) | |
tree | 4cbc1b284c2e19b62fff4fe3fde31d5a06596d48 /lib/memcache | |
parent | 680ac48856a4fff2445f0be3707d846b46ae670c (diff) | |
download | nextcloud-server-aba64a0b81853dd3153da708538dddc96bbe647d.tar.gz nextcloud-server-aba64a0b81853dd3153da708538dddc96bbe647d.zip |
Class Auto Loader: Cache paths in APC
Using benchmark_single.php (from administration repo) I can
measure a speed improvement of 5% to 20% loading the /index.php
when logged in. (when using APC and php-fpm).
Diffstat (limited to 'lib/memcache')
-rw-r--r-- | lib/memcache/factory.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/memcache/factory.php b/lib/memcache/factory.php index 4c1b1ab207f..fde7d947567 100644 --- a/lib/memcache/factory.php +++ b/lib/memcache/factory.php @@ -37,4 +37,33 @@ class Factory { public function isAvailable() { return XCache::isAvailable() || APCu::isAvailable() || APC::isAvailable() || Memcached::isAvailable(); } + + /** + * get a in-server cache instance, will return null if no backend is available + * + * @param string $prefix + * @return \OC\Memcache\Cache + */ + public static function createLowLatency($prefix = '') { + if (XCache::isAvailable()) { + return new XCache($prefix); + } elseif (APCu::isAvailable()) { + return new APCu($prefix); + } elseif (APC::isAvailable()) { + return new APC($prefix); + } else { + return null; + } + } + + /** + * check if there is a in-server backend available + * + * @return bool + */ + public static function isAvailableLowLatency() { + return XCache::isAvailable() || APCu::isAvailable() || APC::isAvailable(); + } + + } |