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/entities.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'engine/lib/entities.php') diff --git a/engine/lib/entities.php b/engine/lib/entities.php index 1daa46a00..d1c4ba3eb 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -921,7 +921,7 @@ global $ENTITY_CACHE; if (!$ENTITY_CACHE) - $ENTITY_CACHE = new ElggStaticVariableCache('entity_cache'); // TODO: Replace with memcache? + $ENTITY_CACHE = select_default_memcache('entity_cache'); // TODO: Replace with memcache? } /** @@ -1013,7 +1013,8 @@ if ($result) { - if (!$SUBTYPE_CACHE) $SUBTYPE_CACHE = new ElggStaticVariableCache('subtype_cache'); + if (!$SUBTYPE_CACHE) + $SUBTYPE_CACHE = select_default_memcache('subtype_cache'); $SUBTYPE_CACHE[$result->id] = $result; return $result->id; @@ -1043,7 +1044,8 @@ $result = get_data_row("SELECT * from {$CONFIG->dbprefix}entity_subtypes where id=$subtype_id"); if ($result) { - if (!$SUBTYPE_CACHE) $SUBTYPE_CACHE = new ElggStaticVariableCache('subtype_cache'); + if (!$SUBTYPE_CACHE) + $SUBTYPE_CACHE = select_default_memcache('subtype_cache'); $SUBTYPE_CACHE[$subtype_id] = $result; return $result->subtype; @@ -1071,7 +1073,8 @@ $result = get_data_row("SELECT * from {$CONFIG->dbprefix}entity_subtypes where type='$type' and subtype='$subtype'"); if ($result) { - if (!$SUBTYPE_CACHE) $SUBTYPE_CACHE = new ElggStaticVariableCache('subtype_cache'); + if (!$SUBTYPE_CACHE) + $SUBTYPE_CACHE = select_default_memcache('subtype_cache'); $SUBTYPE_CACHE[$result->id] = $result; return $result->class; @@ -1100,7 +1103,8 @@ $result = get_data_row("SELECT * from {$CONFIG->dbprefix}entity_subtypes where id=$subtype_id"); if ($result) { - if (!$SUBTYPE_CACHE) $SUBTYPE_CACHE = new ElggStaticVariableCache('subtype_cache'); + if (!$SUBTYPE_CACHE) + $SUBTYPE_CACHE = select_default_memcache('subtype_cache'); $SUBTYPE_CACHE[$subtype_id] = $result; return $result->class; -- cgit v1.2.3