1<?php 2 3declare(strict_types=1); 4 5namespace voku\cache; 6 7/** 8 * iAdapter: cache-adapter interface 9 */ 10interface iAdapter 11{ 12 /** 13 * Get cached-item by key. 14 * 15 * @param string $key 16 * 17 * @return mixed|null <p>will return NULL if the key not exists</p> 18 */ 19 public function get(string $key); 20 21 /** 22 * Set cache-item by key => value. 23 * 24 * @param string $key 25 * @param mixed $value 26 * 27 * @return bool 28 */ 29 public function set(string $key, $value): bool; 30 31 /** 32 * Set cache-item by key => value + ttl. 33 * 34 * @param string $key 35 * @param mixed $value 36 * @param int $ttl 37 * 38 * @return bool 39 */ 40 public function setExpired(string $key, $value, int $ttl): bool; 41 42 /** 43 * Remove cached-item by key. 44 * 45 * @param string $key 46 * 47 * @return bool 48 */ 49 public function remove(string $key): bool; 50 51 /** 52 * Remove all cached items. 53 * 54 * @return bool 55 */ 56 public function removeAll(): bool; 57 58 /** 59 * Check if cache-key exists. 60 * 61 * @param string $key 62 * 63 * @return bool 64 */ 65 public function exists(string $key): bool; 66 67 /** 68 * Check if cache is installed. 69 * 70 * @return bool 71 */ 72 public function installed(): bool; 73} 74