Skip to content

Commit

Permalink
perf(privatesettings): getting a single settings uses cached data
Browse files Browse the repository at this point in the history
  • Loading branch information
jdalsem committed Jul 13, 2018
1 parent b291c14 commit 21be3e8
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions engine/classes/Elgg/Database/PrivateSettingsTable.php
Expand Up @@ -61,24 +61,7 @@ public function __construct(Database $db, EntityTable $entities, ElggCache $cach
* @throws DatabaseException
*/
public function get(ElggEntity $entity, $name) {
$values = $this->cache->load($entity->guid);

if (isset($values[$name])) {
return $values[$name];
}

$qb = Select::fromTable('private_settings');
$qb->select('name')
->addSelect('value')
->where($qb->compare('name', '=', $name, ELGG_VALUE_STRING))
->andWhere($qb->compare('entity_guid', '=', $entity->guid, ELGG_VALUE_INTEGER));

$setting = $this->db->getDataRow($qb);
if ($setting) {
return $setting->value;
}

return null;
return elgg_extract($name, $this->getAllForEntity($entity));
}

/**
Expand Down

0 comments on commit 21be3e8

Please sign in to comment.