| 1 | <?php |
| 2 | /* |
| 3 | +--------------------------------------------------------------------+ |
| 4 | | Copyright CiviCRM LLC. All rights reserved. | |
| 5 | | | |
| 6 | | This work is published under the GNU AGPLv3 license with some | |
| 7 | | permitted exceptions and without any warranty. For full license | |
| 8 | | and copyright information, see https://civicrm.org/licensing | |
| 9 | +--------------------------------------------------------------------+ |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * |
| 14 | * @package CRM |
| 15 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
| 16 | */ |
| 17 | class CRM_Utils_Cache_NoCache implements CRM_Utils_Cache_Interface { |
| 18 | |
| 19 | // TODO Consider native implementation. |
| 20 | use CRM_Utils_Cache_NaiveMultipleTrait; |
| 21 | // TODO Native implementation |
| 22 | use CRM_Utils_Cache_NaiveHasTrait; |
| 23 | |
| 24 | /** |
| 25 | * We only need one instance of this object. So we use the singleton |
| 26 | * pattern and cache the instance in this variable |
| 27 | * |
| 28 | * @var object |
| 29 | */ |
| 30 | static private $_singleton = NULL; |
| 31 | |
| 32 | /** |
| 33 | * Constructor. |
| 34 | * |
| 35 | * @param array $config |
| 36 | * An array of configuration params. |
| 37 | * |
| 38 | * @return \CRM_Utils_Cache_NoCache |
| 39 | */ |
| 40 | public function __construct($config) { |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * @param string $key |
| 45 | * @param mixed $value |
| 46 | * @param null|int|\DateInterval $ttl |
| 47 | * |
| 48 | * @return bool |
| 49 | */ |
| 50 | public function set($key, $value, $ttl = NULL) { |
| 51 | return FALSE; |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * @param string $key |
| 56 | * @param mixed $default |
| 57 | * |
| 58 | * @return null |
| 59 | */ |
| 60 | public function get($key, $default = NULL) { |
| 61 | return $default; |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * @param string $key |
| 66 | * |
| 67 | * @return bool |
| 68 | */ |
| 69 | public function delete($key) { |
| 70 | return FALSE; |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * @return bool |
| 75 | */ |
| 76 | public function flush() { |
| 77 | return FALSE; |
| 78 | } |
| 79 | |
| 80 | public function clear() { |
| 81 | return $this->flush(); |
| 82 | } |
| 83 | |
| 84 | } |