aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-11-04 15:31:33 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-11-04 15:31:33 +0000
commita802d2f468c4d964bac02f9cd675c9d78aebab79 (patch)
treec07113ae1b5740665fc39fd6335f747e2243e3e7 /engine/lib
parent4ba5e14afd2d366b9fcdbdce76c7bc7ad6fbf31a (diff)
downloadelgg-a802d2f468c4d964bac02f9cd675c9d78aebab79.tar.gz
elgg-a802d2f468c4d964bac02f9cd675c9d78aebab79.tar.bz2
Refs #514 : Using memcache if available
git-svn-id: https://code.elgg.org/elgg/trunk@2394 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-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