Passed
Push — master ( 01ad3a...c5e11d )
by Jean-Christophe
05:40
created

QueryCache::delete()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

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