aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/elgglib.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib/elgglib.php')
-rw-r--r--engine/lib/elgglib.php22
1 files changed, 20 insertions, 2 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index c89ab2789..9d677a483 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -1690,14 +1690,32 @@
if ($datalist_memcache) $value = $datalist_memcache->load($name);
if ($value) return $value;
- if ($row = get_data_row("SELECT value from {$CONFIG->dbprefix}datalists where name = '{$name}' limit 1")) {
+ // [Marcus Povey 20090217 : Now retrieving all datalist values on first load as this saves about 9 queries per page]
+ $result = get_data("SELECT * from {$CONFIG->dbprefix}datalists");
+ if ($result)
+ {
+ foreach ($result as $row)
+ {
+ $DATALIST_CACHE[$row->name] = $row->value;
+
+ // Cache it if memcache is available
+ if ($datalist_memcache) $datalist_memcache->save($name, $row->value);
+ }
+
+ if (isset($DATALIST_CACHE[$name]))
+ return $DATALIST_CACHE[$name];
+ }
+
+
+ /*if ($row = get_data_row("SELECT value from {$CONFIG->dbprefix}datalists where name = '{$name}' limit 1")) {
$DATALIST_CACHE[$name] = $row->value;
// Cache it if memcache is available
if ($datalist_memcache) $datalist_memcache->save($name, $row->value);
return $row->value;
- }
+ }*/
+
return false;
}