These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /* |
||
4 | * This file is part of the Ivory Http Adapter package. |
||
5 | * |
||
6 | * (c) Eric GELOEN <[email protected]> |
||
7 | * |
||
8 | * For the full copyright and license information, please read the LICENSE |
||
9 | * file that was distributed with this source code. |
||
10 | */ |
||
11 | |||
12 | namespace Ivory\HttpAdapter\Event\Cache\Adapter; |
||
13 | |||
14 | use Stash\Pool; |
||
15 | |||
16 | /** |
||
17 | * Stash cache adapter. |
||
18 | * |
||
19 | * @author GeLo <[email protected]> |
||
20 | */ |
||
21 | class StashCacheAdapter implements CacheAdapterInterface |
||
22 | { |
||
23 | /** @var \Stash\Pool */ |
||
24 | private $pool; |
||
25 | |||
26 | /** |
||
27 | * Creates a stash cache. |
||
28 | * |
||
29 | * @param \Stash\Pool $pool The stash pool. |
||
30 | */ |
||
31 | 45 | public function __construct(Pool $pool) |
|
32 | { |
||
33 | 45 | $this->pool = $pool; |
|
34 | 45 | } |
|
35 | |||
36 | /** |
||
37 | * {@inheritdoc} |
||
38 | */ |
||
39 | 9 | public function has($id) |
|
40 | { |
||
41 | 9 | return !$this->pool->getItem($id)->isMiss(); |
|
42 | } |
||
43 | |||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | */ |
||
47 | 9 | public function get($id) |
|
48 | { |
||
49 | 9 | return $this->pool->getItem($id)->get(); |
|
50 | } |
||
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | 9 | public function set($id, $data, $lifeTime = 0) |
|
56 | { |
||
57 | 9 | $result = $this->pool->getItem($id)->set($data, $lifeTime); |
|
58 | 9 | $this->pool->flush(); |
|
0 ignored issues
–
show
|
|||
59 | |||
60 | 9 | return $result; |
|
61 | } |
||
62 | |||
63 | /** |
||
64 | * {@inheritdoc} |
||
65 | */ |
||
66 | 9 | public function remove($id) |
|
67 | { |
||
68 | 9 | $result = $this->pool->getItem($id)->clear(); |
|
69 | 9 | $this->pool->flush(); |
|
0 ignored issues
–
show
The method
flush() does not seem to exist on object<Stash\Pool> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
70 | |||
71 | 9 | return $result; |
|
72 | } |
||
73 | } |
||
74 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.