Merge in 5.20
[civicrm-core.git] / CRM / Utils / Cache / NoCache.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
bc77d7c0 4 | Copyright CiviCRM LLC. All rights reserved. |
6a488035 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 |
6a488035 9 +--------------------------------------------------------------------+
d25dd0ee 10 */
6a488035
TO
11
12/**
13 *
14 * @package CRM
ca5cec67 15 * @copyright CiviCRM LLC https://civicrm.org/licensing
6a488035 16 */
6a488035
TO
17class CRM_Utils_Cache_NoCache implements CRM_Utils_Cache_Interface {
18
6714d8d2
SL
19 // TODO Consider native implementation.
20 use CRM_Utils_Cache_NaiveMultipleTrait;
21 // TODO Native implementation
22 use CRM_Utils_Cache_NaiveHasTrait;
0d64c8fa 23
6a488035
TO
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
6a488035
TO
29 */
30 static private $_singleton = NULL;
31
32 /**
fe482240 33 * Constructor.
6a488035 34 *
77855840
TO
35 * @param array $config
36 * An array of configuration params.
6a488035 37 *
77b97be7 38 * @return \CRM_Utils_Cache_NoCache
6a488035 39 */
00be9182 40 public function __construct($config) {
6a488035
TO
41 }
42
5bc392e6
EM
43 /**
44 * @param string $key
45 * @param mixed $value
858451a9 46 * @param null|int|\DateInterval $ttl
5bc392e6
EM
47 *
48 * @return bool
49 */
858451a9 50 public function set($key, $value, $ttl = NULL) {
6a488035
TO
51 return FALSE;
52 }
53
5bc392e6
EM
54 /**
55 * @param string $key
2da67cc5 56 * @param mixed $default
5bc392e6
EM
57 *
58 * @return null
59 */
2da67cc5
TO
60 public function get($key, $default = NULL) {
61 return $default;
6a488035
TO
62 }
63
5bc392e6
EM
64 /**
65 * @param string $key
66 *
67 * @return bool
68 */
00be9182 69 public function delete($key) {
6a488035
TO
70 return FALSE;
71 }
72
5bc392e6
EM
73 /**
74 * @return bool
75 */
00be9182 76 public function flush() {
6a488035
TO
77 return FALSE;
78 }
96025800 79
c31de879
TO
80 public function clear() {
81 return $this->flush();
82 }
83
6a488035 84}