aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
Diffstat (limited to 'engine')
-rw-r--r--engine/lib/cache.php15
1 files changed, 10 insertions, 5 deletions
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