Repository navigation
Expand file tree
/
Copy pathCache.php
More file actions
71 lines (57 loc) · 1.6 KB
/
Copy pathCache.php
File metadata and controls
71 lines (57 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\Cache;
use Hyperf\Cache\Driver\DriverInterface;
use Psr\SimpleCache\CacheInterface;
class Cache implements CacheInterface
{
protected DriverInterface $driver;
public function __construct(CacheManager $manager)
{
$this->driver = $manager->getDriver();
}
public function __call($name, $arguments)
{
return $this->driver->{$name}(...$arguments);
}
public function get($key, $default = null): mixed
{
return $this->__call(__FUNCTION__, func_get_args());
}
public function set($key, $value, $ttl = null): bool
{
return $this->__call(__FUNCTION__, func_get_args());
}
public function delete($key): bool
{
return $this->__call(__FUNCTION__, func_get_args());
}
public function clear(): bool
{
return $this->__call(__FUNCTION__, func_get_args());
}
public function getMultiple($keys, $default = null): iterable
{
return $this->__call(__FUNCTION__, func_get_args());
}
public function setMultiple($values, $ttl = null): bool
{
return $this->__call(__FUNCTION__, func_get_args());
}
public function deleteMultiple($keys): bool
{
return $this->__call(__FUNCTION__, func_get_args());
}
public function has($key): bool
{
return $this->__call(__FUNCTION__, func_get_args());
}
}