| 1 | <?php |
||
| 27 | trait LocalCacheTrait |
||
| 28 | { |
||
| 29 | /** |
||
| 30 | * a local cache |
||
| 31 | * |
||
| 32 | * @var array |
||
| 33 | * @access private |
||
| 34 | */ |
||
| 35 | private $local_cache = []; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Clear local cache |
||
| 39 | * |
||
| 40 | * @return $this |
||
| 41 | * @access protected |
||
| 42 | */ |
||
| 43 | protected function clearLocalCache() |
||
| 48 | |||
| 49 | /** |
||
| 50 | * has cached ? |
||
| 51 | * |
||
| 52 | * @param string $name |
||
| 53 | * @return bool |
||
| 54 | * @access protected |
||
| 55 | */ |
||
| 56 | protected function hasLocalCache(/*# strign */ $name)/*# : bool */ |
||
| 60 | |||
| 61 | /** |
||
| 62 | * get the cached value |
||
| 63 | * |
||
| 64 | * @param string $name |
||
| 65 | * @return mixed |
||
| 66 | * @access protected |
||
| 67 | */ |
||
| 68 | protected function getLocalCache(/*# strign */ $name) |
||
| 72 | |||
| 73 | /** |
||
| 74 | * set the cache |
||
| 75 | * |
||
| 76 | * @param string $name |
||
| 77 | * @param mixed $value |
||
| 78 | * @return $this |
||
| 79 | * @access protected |
||
| 80 | */ |
||
| 81 | protected function setLocalCache(/*# strign */ $name, $value) |
||
| 86 | } |
||
| 87 |