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. |
||
9 | * |
||
10 | * @since Symphony 2.3.5 |
||
11 | */ |
||
12 | interface iCache |
||
0 ignored issues
–
show
|
|||
13 | { |
||
14 | /** |
||
15 | * Returns the human readable name of this cache type. This is |
||
16 | * displayed in the system preferences cache options. |
||
17 | * |
||
18 | * @return string |
||
19 | */ |
||
20 | public static function getName(); |
||
21 | |||
22 | /** |
||
23 | * This function returns all the settings of the current Cache |
||
24 | * instance. |
||
25 | * |
||
26 | * @return array |
||
27 | * An associative array of settings for this cache where the |
||
28 | * key is `getClass` and the value is an associative array of settings, |
||
29 | * key being the setting name, value being, the value |
||
30 | */ |
||
31 | public function settings(); |
||
32 | |||
33 | /** |
||
34 | * Given the hash of a some data, check to see whether it exists in |
||
35 | * `tbl_cache`. If no cached object is found, this function will return |
||
36 | * false, otherwise the cached object will be returned as an array. |
||
37 | * |
||
38 | * @param string $hash |
||
39 | * The hash of the Cached object, as defined by the user |
||
40 | * @return array|boolean |
||
41 | * An associative array of the cached object including the creation time, |
||
42 | * expiry time, the hash and the data. If the object is not found, false will |
||
43 | * be returned. |
||
44 | */ |
||
45 | public function read($hash); |
||
46 | |||
47 | /** |
||
48 | * This function will compress data for storage in `tbl_cache`. |
||
49 | * It is left to the user to define a unique hash for this data so that it can be |
||
50 | * retrieved in the future. Optionally, a `$ttl` parameter can |
||
51 | * be passed for this data. If this is omitted, it data is considered to be valid |
||
52 | * forever. This function utilizes the Mutex class to act as a crude locking |
||
53 | * mechanism. |
||
54 | * |
||
55 | * @see toolkit.Mutex |
||
56 | * @param string $hash |
||
57 | * The hash of the Cached object, as defined by the user |
||
58 | * @param string $data |
||
59 | * The data to be cached, this will be compressed prior to saving. |
||
60 | * @param integer $ttl |
||
61 | * A integer representing how long the data should be valid for in minutes. |
||
62 | * By default this is null, meaning the data is valid forever |
||
63 | * @return boolean |
||
64 | * If an error occurs, this function will return false otherwise true |
||
65 | */ |
||
66 | public function write($hash, $data, $ttl = null); |
||
0 ignored issues
–
show
|
|||
67 | |||
68 | /** |
||
69 | * Given the hash of a cacheable object, remove it from `tbl_cache` |
||
70 | * regardless of if it has expired or not. If no $hash is given, |
||
71 | * this removes all cache objects from `tbl_cache` that have expired. |
||
72 | * After removing, the function uses the `__optimise` function |
||
73 | * |
||
74 | * @see core.Cacheable#optimise() |
||
75 | * @param string $hash |
||
76 | * The hash of the Cached object, as defined by the user |
||
77 | */ |
||
78 | public function delete($hash); |
||
79 | } |
||
80 |
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
.