1 | <?php |
||
2 | |||
3 | /** |
||
4 | * @package interface |
||
5 | */ |
||
6 | /** |
||
7 | * This interface is to be implemented by Extensions who wish to provide |
||
8 | * cacheable objects for Symphony to use and whose cache providers support |
||
9 | * namespacing to make bulk read, writes and deletes. |
||
10 | * |
||
11 | * @since Symphony 2.6.0 |
||
12 | */ |
||
13 | interface iNamespacedCache |
||
0 ignored issues
–
show
|
|||
14 | { |
||
15 | /** |
||
16 | * Returns the human readable name of this cache type. This is |
||
17 | * displayed in the system preferences cache options. |
||
18 | * |
||
19 | * @return string |
||
20 | */ |
||
21 | public static function getName(); |
||
22 | |||
23 | /** |
||
24 | * This function returns all the settings of the current Cache |
||
25 | * instance. |
||
26 | * |
||
27 | * @return array |
||
28 | * An associative array of settings for this cache where the |
||
29 | * key is `getClass` and the value is an associative array of settings, |
||
30 | * key being the setting name, value being, the value |
||
31 | */ |
||
32 | public function settings(); |
||
33 | |||
34 | /** |
||
35 | * Given the hash of a some data, check to see whether it exists in |
||
36 | * `tbl_cache`. If no cached object is found, this function will return |
||
37 | * false, otherwise the cached object will be returned as an array. |
||
38 | * |
||
39 | * @param string $hash |
||
40 | * The hash of the Cached object, as defined by the user |
||
41 | * @param string $namespace |
||
42 | * The namespace allows a group of data to be retrieved at once |
||
43 | * @return array|boolean |
||
44 | * An associative array of the cached object including the creation time, |
||
45 | * expiry time, the hash and the data. If the object is not found, false will |
||
46 | * be returned. |
||
47 | */ |
||
48 | public function read($hash, $namespace = null); |
||
0 ignored issues
–
show
|
|||
49 | |||
50 | /** |
||
51 | * This function will compress data for storage in `tbl_cache`. |
||
52 | * It is left to the user to define a unique hash for this data so that it can be |
||
53 | * retrieved in the future. Optionally, a `$ttl` parameter can |
||
54 | * be passed for this data. If this is omitted, it data is considered to be valid |
||
55 | * forever. This function utilizes the Mutex class to act as a crude locking |
||
56 | * mechanism. |
||
57 | * |
||
58 | * @see toolkit.Mutex |
||
59 | * @param string $hash |
||
60 | * The hash of the Cached object, as defined by the user |
||
61 | * @param string $data |
||
62 | * The data to be cached, this will be compressed prior to saving. |
||
63 | * @param integer $ttl |
||
64 | * A integer representing how long the data should be valid for in minutes. |
||
65 | * By default this is null, meaning the data is valid forever |
||
66 | * @param string $namespace |
||
67 | * The namespace allows data to be grouped and saved so it can be |
||
68 | * retrieved later. |
||
69 | * @return boolean |
||
70 | * If an error occurs, this function will return false otherwise true |
||
71 | */ |
||
72 | public function write($hash, $data, $ttl = null, $namespace = null); |
||
0 ignored issues
–
show
|
|||
73 | |||
74 | /** |
||
75 | * Given the hash of a cacheable object, remove it from `tbl_cache` |
||
76 | * regardless of if it has expired or not. If no $hash is given, |
||
77 | * this removes all cache objects from `tbl_cache` that have expired. |
||
78 | * After removing, the function uses the `__optimise` function |
||
79 | * |
||
80 | * @see core.Cacheable#optimise() |
||
81 | * @param string $hash |
||
82 | * The hash of the Cached object, as defined by the user |
||
83 | * @param string $namespace |
||
84 | * The namespace allows similar data to be deleted quickly. |
||
85 | */ |
||
86 | public function delete($hash, $namespace = null); |
||
0 ignored issues
–
show
|
|||
87 | } |
||
88 |
Classes in PHP are usually named in CamelCase.
In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. The whole name starts with a capital letter as well.
Thus the name database provider becomes
DatabaseProvider
.