Completed
Push — master ( a48513...213d8d )
by Jean-Christophe
01:39
created

QueryCache::delete()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 2
1
<?php
2
3
namespace Ubiquity\cache\database;
4
5
use Ubiquity\cache\database\DbCache;
6
use Ubiquity\utils\JArray;
7
8
class QueryCache extends DbCache {
9
10
	public function fetch($tableName, $condition) {
11
		$key=$tableName . "." . $this->getKey($condition);
12
		if ($this->cache->exists($key))
13
			return $this->cache->fetch($key);
14
		return false;
15
	}
16
17
	public function store($tableName, $condition, $result) {
18
		$this->cache->store($tableName . "." . $this->getKey($condition), "return " . JArray::asPhpArray($result, "array") . ";");
19
	}
20
21
	public function delete($tableName, $condition){
22
		$key=$tableName . "." . $this->getKey($condition);
23
		if ($this->cache->exists($key))
24
			return $this->cache->remove($key);
25
		return false;
26
	}
27
}
28