From 47b33b9b54610ddf676201acb408bef691c7eac4 Mon Sep 17 00:00:00 2001 From: marcus Date: Tue, 4 Nov 2008 10:45:40 +0000 Subject: Moved caching to function so it can be easily replaced git-svn-id: https://code.elgg.org/elgg/trunk@2390 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/cache.php | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'engine/lib/cache.php') diff --git a/engine/lib/cache.php b/engine/lib/cache.php index 399552785..7523a0a68 100644 --- a/engine/lib/cache.php +++ b/engine/lib/cache.php @@ -167,7 +167,7 @@ * * @var unknown_type */ - private static $__cache; + public static $__cache; /** * ID of a cache to use. @@ -385,4 +385,26 @@ } } } + + + /** + * A simple function that selects the default caching engine. + * + * This function provides a central way to get a cache for storing local variables. + * + * TODO: Do this better & allow plugin overrides. + * + * @param string $namespace Define which memory space to use. + */ + function select_default_memcache($namespace = "default") + { + // hook out to the world ? (can't if using as object cache) + + // if nothing then use shared memory cache. + + // TODO: Use memcache if available? + + return new ElggStaticVariableCache($namespace); + + } ?> \ No newline at end of file -- cgit v1.2.3