1 | <?php namespace Comodojo\Cache\Providers; |
||
31 | abstract class AbstractProvider implements ProviderInterface { |
||
32 | |||
33 | use IdTrait; |
||
34 | use NamespaceTrait; |
||
35 | use StatusSwitchTrait; |
||
36 | use TimeTrait; |
||
37 | use TtlTrait; |
||
38 | use LoggerTrait; |
||
39 | use ErrorStateTrait; |
||
40 | |||
41 | /** |
||
42 | * Class constructor |
||
43 | * |
||
44 | * @throws \Comodojo\Exception\CacheException |
||
45 | */ |
||
46 | 85 | public function __construct(LoggerInterface $logger = null) { |
|
47 | |||
48 | try { |
||
49 | |||
50 | 85 | $this->setTime(); |
|
51 | |||
52 | 85 | $this->setTtl(); |
|
53 | |||
54 | 85 | $this->setCacheId(); |
|
55 | |||
56 | 85 | $this->setLogger($logger); |
|
57 | |||
58 | 85 | } catch (CacheException $ce) { |
|
59 | |||
60 | throw $ce; |
||
61 | |||
62 | } |
||
63 | |||
64 | 85 | } |
|
65 | |||
66 | 1 | public function getType() { |
|
71 | |||
72 | /** |
||
73 | * {@inheritdoc} |
||
74 | */ |
||
75 | abstract public function set($name, $data, $ttl = null); |
||
76 | |||
77 | /** |
||
78 | * {@inheritdoc} |
||
79 | */ |
||
80 | abstract public function get($name); |
||
81 | |||
82 | /** |
||
83 | * {@inheritdoc} |
||
84 | */ |
||
85 | abstract public function delete($name = null); |
||
86 | |||
87 | /** |
||
88 | * {@inheritdoc} |
||
89 | */ |
||
90 | abstract public function flush(); |
||
91 | |||
92 | /** |
||
93 | * {@inheritdoc} |
||
94 | */ |
||
95 | abstract public function status(); |
||
96 | |||
97 | } |
||
98 |