| 1 | <?php |
||
| 9 | class CacheKey { |
||
| 10 | /** |
||
| 11 | * This is the base key. It's the main index, so to speak. This is useful as a |
||
| 12 | * first level to separate cache data logically. |
||
| 13 | * |
||
| 14 | * @var string $base |
||
| 15 | */ |
||
| 16 | public $base; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * This is the second key, usually an id. |
||
| 20 | * @var string |
||
| 21 | */ |
||
| 22 | public $id; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * |
||
| 26 | * @var string |
||
| 27 | */ |
||
| 28 | public $sub; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @param string $base Base string name for the type of cache (e.g., Event) |
||
| 32 | * @param string $id Item id |
||
| 33 | * @param string $sub If an item is cache in parts, this is used to specify the parts. |
||
| 34 | */ |
||
| 35 | public function __construct($base, $id, $sub = '') { |
||
| 40 | |||
| 41 | public function getBase() { |
||
| 44 | |||
| 45 | public function getId() { |
||
| 48 | |||
| 49 | public function getSub() { |
||
| 52 | |||
| 53 | public function setBase($base) { |
||
| 57 | |||
| 58 | public function setId($id) { |
||
| 62 | |||
| 63 | public function setSub($sub) { |
||
| 67 | |||
| 68 | /** |
||
| 69 | * Returns a hash for key. |
||
| 70 | * @return string |
||
| 71 | */ |
||
| 72 | public function getHash() { |
||
| 75 | |||
| 76 | /** |
||
| 77 | * Prints as a pretty string for debugging |
||
| 78 | * @return string |
||
| 79 | * @codeCoverageIgnore |
||
| 80 | */ |
||
| 81 | public function debug() { |
||
| 84 | } |
||
| 85 |