1 | <?php |
||
20 | class CacheManager implements CacheInterface { |
||
21 | |||
22 | /** |
||
23 | * @var CacheDriverInterface |
||
24 | */ |
||
25 | protected $driver; |
||
26 | |||
27 | /** |
||
28 | * Retreive the appropriate driver from the container |
||
29 | */ |
||
30 | public function __construct(ContainerInterface $container) |
||
45 | |||
46 | /** |
||
47 | * Retreive a cached value if it exists, otherwise, get the value |
||
48 | * from the passed arguments |
||
49 | * |
||
50 | * @param object $object - object to retrieve fresh value from |
||
51 | * @param string $method - method name to call |
||
52 | * @param [array] $args - the arguments to pass to the retrieval method |
||
|
|||
53 | * @return mixed - the cached or fresh data |
||
54 | */ |
||
55 | public function get($object, $method, array $args=[]) |
||
69 | |||
70 | /** |
||
71 | * Retreive a fresh value from the method, and update the cache |
||
72 | * @param object $object - object to retrieve fresh value from |
||
73 | * @param string $method - method name to call |
||
74 | * @param [array] $args - the arguments to pass to the retrieval method |
||
75 | * @return mixed - the fresh data |
||
76 | */ |
||
77 | public function getFresh($object, $method, array $args=[]) |
||
84 | |||
85 | /** |
||
86 | * Clear the entire cache |
||
87 | * |
||
88 | * @return void |
||
89 | */ |
||
90 | public function purge() |
||
94 | |||
95 | /** |
||
96 | * Generate a hash as a cache key from the current method call |
||
97 | * |
||
98 | * @param object $object |
||
99 | * @param string $method |
||
100 | * @param array $args |
||
101 | * @return string |
||
102 | */ |
||
103 | protected function generateHashForMethod($object, $method, array $args) |
||
114 | } |
||
115 | // End of CacheManager.php |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.