diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-11-04 10:45:40 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-11-04 10:45:40 +0000 |
commit | 47b33b9b54610ddf676201acb408bef691c7eac4 (patch) | |
tree | b00c8d264fa0b9cfec9b802ade97a87dfa759baf /engine/lib/entities.php | |
parent | e9a37af94c1cb294f561305c94d4e00e0bc49990 (diff) | |
download | elgg-47b33b9b54610ddf676201acb408bef691c7eac4.tar.gz elgg-47b33b9b54610ddf676201acb408bef691c7eac4.tar.bz2 |
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
Diffstat (limited to 'engine/lib/entities.php')
-rw-r--r-- | engine/lib/entities.php | 14 |
1 files changed, 9 insertions, 5 deletions
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; |