Cache.php
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2020 wemove digital solutions GmbH
5  *
6  * Licensed under the terms of the MIT License.
7  *
8  * See the LICENSE file distributed with this work for
9  * additional information.
10  */
11 namespace wcmf\lib\io;
12 
13 /**
14  * Cache defines the interface for cache implementations.
15  *
16  * Caches are divided into different sections, which store
17  * key value pairs.
18  *
19  * @author ingo herwig <ingo@wemove.com>
20  */
21 interface Cache {
22 
23  /**
24  * Check if a cache entry exists
25  * @param $section The cache section
26  * @param $key The cache key
27  * @return boolean
28  */
29  public function exists($section, $key);
30 
31  /**
32  * Get the date of the specified cache entry
33  * @param $section The cache section
34  * @param $key The cache key
35  * @return DateTime or null, if not cached
36  */
37  public function getDate($section, $key);
38 
39  /**
40  * Get the value of the specified cache entry
41  * @param $section The cache section
42  * @param $key The cache key
43  * @return Mixed
44  */
45  public function get($section, $key);
46 
47  /**
48  * Store the value of the specified cache entry with an optional lifetime.
49  * @param $section The cache section
50  * @param $key The key
51  * @param $value The value
52  * @param $lifetime The lifetime in seconds (optional)
53  */
54  public function put($section, $key, $value, $lifetime=null);
55 
56  /**
57  * Clear the given cache section. The wildcard char '*'
58  * may be added to the section name in order to
59  * clear all matching sections.
60  * @param $section The cache section
61  */
62  public function clear($section);
63 
64  /**
65  * Clear all cache sections
66  */
67  public function clearAll();
68 }
69 ?>
Input/Output related interfaces and classes.
Definition: namespaces.php:21
exists($section, $key)
Check if a cache entry exists.
put($section, $key, $value, $lifetime=null)
Store the value of the specified cache entry with an optional lifetime.
clearAll()
Clear all cache sections.
getDate($section, $key)
Get the date of the specified cache entry.
clear($section)
Clear the given cache section.
Cache defines the interface for cache implementations.
Definition: Cache.php:21