diff options
author | icewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-06-09 12:40:45 +0000 |
---|---|---|
committer | icewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-06-09 12:40:45 +0000 |
commit | c522f28c7cf6c37ddd6b2b2a4bcc3093784f7577 (patch) | |
tree | da07039a96a50d94fec2b54d57636334796315fa /engine/lib/users.php | |
parent | 8f4260e2a46eba16ebc2462ec1d23260e8377482 (diff) | |
download | elgg-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/users.php')
-rw-r--r-- | engine/lib/users.php | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/engine/lib/users.php b/engine/lib/users.php index 76d5cac00..795ec4415 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -244,7 +244,7 @@ */
function getFriends($subtype = "", $limit = 10, $offset = 0) { return get_user_friends($this->getGUID(), $subtype, $limit, $offset); }
- /**
+ /**
* Retrieves a list of people who have made this user a friend
*
* @param string $subtype Optionally, the subtype of user to filter to (leave blank for all)
@@ -314,10 +314,26 @@ function get_user_entity_as_row($guid)
{
global $CONFIG;
+ + $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"); +
+ $guid = (int)$guid;
- $guid = (int)$guid;
-
- return get_data_row("SELECT * from {$CONFIG->dbprefix}users_entity where guid=$guid");
+ return get_data_row("SELECT * from {$CONFIG->dbprefix}users_entity where guid=$guid"); + }
}
/**
|