Commit | Line | Data |
---|---|---|
9f70b0e4 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
bc77d7c0 | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
9f70b0e4 | 5 | | | |
bc77d7c0 TO |
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 | | |
9f70b0e4 TO |
9 | +--------------------------------------------------------------------+ |
10 | */ | |
11 | ||
12 | /** | |
13 | * | |
14 | * @package CRM | |
ca5cec67 | 15 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
9f70b0e4 TO |
16 | * |
17 | * The traditional CRM_Utils_Cache_Interface did not support has(). | |
18 | * To get drop-in compliance with PSR-16, we use a naive adapter. | |
19 | * | |
8f7f4610 | 20 | * There may be opportunities to replace/optimize in specific drivers. |
9f70b0e4 TO |
21 | */ |
22 | trait CRM_Utils_Cache_NaiveHasTrait { | |
23 | ||
24 | public function has($key) { | |
89861474 | 25 | $nack = CRM_Utils_Cache::nack(); |
8f7f4610 TO |
26 | $value = $this->get($key, $nack); |
27 | return ($value !== $nack); | |
9f70b0e4 TO |
28 | } |
29 | ||
30 | } |