Completed
Push — master ( c385cb...b0036f )
by Wei
04:12
created

RedisCacheProvider::clear()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * User: derekzhangv
4
 * Time: 2018/5/29 16:41
5
 */
6
namespace zhangv\wechat\cache;
7
class RedisCacheProvider implements CacheProvider{
8
	/** @var Redis */
9
	private $redis = null;
10
11
	public function __construct($redis = null){
12
		$this->redis = $redis;
13
	}
14
15
	public function set($key,$jsonobj,$expireAt){
16
		$data = $jsonobj;
17
		$data->expires_at = $expireAt;
18
		$this->redis->set($key, json_encode($data));
19
	}
20
21
	public function get($key){
22
		return $this->redis->get($key);
23
	}
24
25
	public function clear($key){
26
		$this->redis->delete($key);
27
	}
28
}