| Total Complexity | 8 |
| Total Lines | 70 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | abstract class AbstractCache implements Cacheable |
||
| 6 | { |
||
| 7 | /** @var int TTL in secs (default 1 day) */ |
||
| 8 | protected $ttl = 86400; |
||
| 9 | |||
| 10 | /** @var string Prefix for cache keys */ |
||
| 11 | protected $prefix = 'tus:'; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * Set time to live. |
||
| 15 | * |
||
| 16 | * @param int $secs |
||
| 17 | */ |
||
| 18 | 2 | public function setTtl(int $secs) |
|
| 19 | { |
||
| 20 | 2 | $this->ttl = $secs; |
|
| 21 | 2 | } |
|
| 22 | |||
| 23 | /** |
||
| 24 | * {@inheritDoc} |
||
| 25 | */ |
||
| 26 | 1 | public function getTtl() : int |
|
| 27 | { |
||
| 28 | 1 | return $this->ttl; |
|
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Set cache prefix. |
||
| 33 | * |
||
| 34 | * @param string $prefix |
||
| 35 | * |
||
| 36 | * @return Cacheable |
||
| 37 | */ |
||
| 38 | 2 | public function setPrefix(string $prefix) : Cacheable |
|
| 39 | { |
||
| 40 | 2 | $this->prefix = $prefix; |
|
| 41 | |||
| 42 | 2 | return $this; |
|
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * Get cache prefix. |
||
| 47 | * |
||
| 48 | * @return string |
||
| 49 | */ |
||
| 50 | 2 | public function getPrefix() : string |
|
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * Delete all keys. |
||
| 57 | * |
||
| 58 | * @param array $keys |
||
| 59 | * |
||
| 60 | * @return bool |
||
| 61 | */ |
||
| 62 | 2 | public function deleteAll(array $keys) : bool |
|
| 75 | } |
||
| 76 | } |
||
| 77 |