From a802d2f468c4d964bac02f9cd675c9d78aebab79 Mon Sep 17 00:00:00 2001 From: marcus Date: Tue, 4 Nov 2008 15:31:33 +0000 Subject: Refs #514 : Using memcache if available git-svn-id: https://code.elgg.org/elgg/trunk@2394 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/cache.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'engine/lib') diff --git a/engine/lib/cache.php b/engine/lib/cache.php index dcbb83ca6..fa5f990df 100644 --- a/engine/lib/cache.php +++ b/engine/lib/cache.php @@ -398,13 +398,18 @@ */ function select_default_memcache($namespace = "default") { - // hook out to the world ? (can't if using as object cache) + global $CONFIG; + // TODO : hook out to the world ? (can't if using as object cache) - // if nothing then use shared memory cache. - - // TODO: Use memcache if available? + // Try and see if memcache is present & enabled + try { + if ((isset($CONFIG->memcache) && ($CONFIG->memcache=true))) + return new ElggMemcache($namespace); + } catch (Exception $e) { + if ((isset($CONFIG->debug)) && ($CONFIG->debug == true)) + error_log("$e"); + } return new ElggStaticVariableCache($namespace); - } ?> \ No newline at end of file -- cgit v1.2.3