1 | <?php |
||
10 | class CheckableCache |
||
11 | { |
||
12 | 89 | function __construct(Cache $impl){ |
|
15 | |||
16 | /** |
||
17 | * 设置cache |
||
18 | * |
||
19 | * @param string $name |
||
20 | * @param mixed $var |
||
21 | * @param int |
||
22 | * @param callable $expireCheck |
||
23 | * @return boolean |
||
24 | * 缓存过期检查方法, 缓存过期(超过ttl)后, get时调用, 返回true表示缓存继续可用. |
||
25 | * 如checker($got_var, $time) |
||
26 | * |
||
27 | */ |
||
28 | 21 | public function set($name, $var, $ttl = 0, callable $expireCheck = null) |
|
38 | |||
39 | /** |
||
40 | * @param string $name |
||
41 | * @param mixed|null $default |
||
42 | * @param mixed|null $expiredData |
||
43 | * @param bool $deleteExpiredData |
||
44 | * @return mixed |
||
45 | */ |
||
46 | 89 | public function get($name, $default = null, &$expiredData=null, $deleteExpiredData=true) |
|
74 | /** |
||
75 | * 删除 |
||
76 | * @param string $name |
||
77 | */ |
||
78 | public function del($name){ |
||
85 | /** |
||
86 | * @var Cache |
||
87 | */ |
||
88 | private $impl; |
||
89 | } |
||
90 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.