| 1 | <?php |
||
| 9 | class CacheItem implements CacheItemInterface |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var string |
||
| 13 | */ |
||
| 14 | private $key; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var mixed|null |
||
| 18 | */ |
||
| 19 | private $value; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var bool |
||
| 23 | */ |
||
| 24 | private $hit; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @var \DateTimeInterface|\DateInterval|int |
||
| 28 | */ |
||
| 29 | private $expires; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @param string $key |
||
| 33 | * @param mixed $value |
||
| 34 | * @param bool $hit |
||
| 35 | */ |
||
| 36 | 31 | public function __construct($key, $value = null, $hit = false) |
|
| 42 | |||
| 43 | /** |
||
| 44 | * {@inheritdoc} |
||
| 45 | */ |
||
| 46 | 19 | public function getKey() |
|
| 50 | |||
| 51 | /** |
||
| 52 | * {@inheritdoc} |
||
| 53 | */ |
||
| 54 | 21 | public function get() |
|
| 58 | |||
| 59 | /** |
||
| 60 | * {@inheritdoc} |
||
| 61 | */ |
||
| 62 | 16 | public function isHit() |
|
| 66 | |||
| 67 | /** |
||
| 68 | * {@inheritdoc} |
||
| 69 | */ |
||
| 70 | 9 | public function set($value) |
|
| 76 | |||
| 77 | /** |
||
| 78 | * {@inheritdoc} |
||
| 79 | */ |
||
| 80 | 5 | public function expiresAt($expiration) |
|
| 86 | |||
| 87 | /** |
||
| 88 | * {@inheritdoc} |
||
| 89 | */ |
||
| 90 | 4 | public function expiresAfter($time) |
|
| 96 | |||
| 97 | /** |
||
| 98 | * @return int|null |
||
| 99 | * The amount of minutes this item should stay alive. Or null when no expires is given. |
||
| 100 | */ |
||
| 101 | 21 | public function getTTL() |
|
| 117 | } |
||
| 118 |