RedisCacheProvider::clear()   A
last analyzed

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
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 2
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * RedisCacheProvider
4
 *
5
 * @license MIT
6
 * @author zhangv
7
 */
8
namespace zhangv\wechat\pay\cache;
9
class RedisCacheProvider implements CacheProvider{
10
	/** @var Redis */
11
	private $redis = null;
12
13 2
	public function __construct($redis = null){
14 2
		$this->redis = $redis;
15 2
	}
16
17 1
	public function set($key,$jsonobj,$expireAt){
18 1
		$data = $jsonobj;
19 1
		$data->expires_at = $expireAt;
20 1
		$this->redis->set($key, json_encode($data));
21 1
	}
22
23 2
	public function get($key){
24 2
		return $this->redis->get($key);
25
	}
26
27 1
	public function clear($key){
28 1
		$this->redis->delete($key);
29
	}
30
}