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

QueryCache::store()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 2
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 1
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