Skip to content

Commit

Permalink
Don't cache groups (#641)
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Oct 15, 2017
1 parent bb8ca52 commit 1efdbbd
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/Util/EntityFactory.php
Expand Up @@ -28,6 +28,7 @@

use Volkszaehler\Util;
use Volkszaehler\Definition\PropertyDefinition;
use Volkszaehler\Model\Aggregator;

/**
* Entity factory
Expand Down Expand Up @@ -219,14 +220,18 @@ public function remove($key) {
*
* @throws Exception
*/
protected function cached($key, $cache, $callable) {
private function cached($key, $cache, $callable) {
if ($cache && $this->cache->contains($key)) {
return $this->cache->fetch($key);
$entity = $this->cache->fetch($key);

if (!$entity instanceof Aggregator) {
return $entity;
}
}

$entity = $callable();

if (isset($entity) && $cache) {
if ($cache && isset($entity) &! $entity instanceof Aggregator) {
if (!isset($this->ttl)) {
$this->ttl = Util\Configuration::read('cache.ttl', 3600);
}
Expand Down

0 comments on commit 1efdbbd

Please sign in to comment.