aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/sites.php
diff options
context:
space:
mode:
authoricewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-09 12:40:45 +0000
committericewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-09 12:40:45 +0000
commitc522f28c7cf6c37ddd6b2b2a4bcc3093784f7577 (patch)
treeda07039a96a50d94fec2b54d57636334796315fa /engine/lib/sites.php
parent8f4260e2a46eba16ebc2462ec1d23260e8377482 (diff)
downloadelgg-c522f28c7cf6c37ddd6b2b2a4bcc3093784f7577.tar.gz
elgg-c522f28c7cf6c37ddd6b2b2a4bcc3093784f7577.tar.bz2
Marcus Povey <marcus@dushka.co.uk>
* Added caching to entities. Please report any problems. git-svn-id: https://code.elgg.org/elgg/trunk@831 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/sites.php')
-rw-r--r--engine/lib/sites.php20
1 files changed, 17 insertions, 3 deletions
diff --git a/engine/lib/sites.php b/engine/lib/sites.php
index 9823f097a..89a95812e 100644
--- a/engine/lib/sites.php
+++ b/engine/lib/sites.php
@@ -212,8 +212,6 @@
*/
public function getCollections($subtype="", $limit = 10, $offset = 0) { get_site_collections($this->getGUID(), $subtype, $limit, $offset); }
-
-
}
/**
@@ -227,7 +225,23 @@
$guid = (int)$guid;
- return get_data_row("SELECT * from {$CONFIG->dbprefix}sites_entity where guid=$guid");
+ $row = retrieve_cached_entity_row($guid);
+ if ($row)
+ {
+ // We have already cached this object, so retrieve its value from the cache
+ if ($CONFIG->debug)
+ error_log("** Retrieving sub part of GUID:$guid from cache");
+
+ return $row;
+ }
+ else
+ {
+ // Object not cached, load it.
+ if ($CONFIG->debug)
+ error_log("** Sub part of GUID:$guid loaded from DB");
+
+ return get_data_row("SELECT * from {$CONFIG->dbprefix}sites_entity where guid=$guid");
+ }
}
/**