1 | <?php |
||
30 | class CacheManager |
||
31 | { |
||
32 | /** |
||
33 | * Cache Access objects for pools |
||
34 | * |
||
35 | * @var Access[] |
||
36 | */ |
||
37 | protected $pools = []; |
||
38 | |||
39 | /** |
||
40 | * Pool definitions |
||
41 | * |
||
42 | * @var array |
||
43 | */ |
||
44 | protected $poolDefs = []; |
||
45 | |||
46 | /** |
||
47 | * Xoops instance |
||
48 | * |
||
49 | * @var \Xoops |
||
50 | */ |
||
51 | protected $xoops; |
||
52 | |||
53 | /** |
||
54 | * __construct |
||
55 | */ |
||
56 | public function __construct() |
||
69 | |||
70 | /** |
||
71 | * getDefaults get default cache configuration used if there is no config file |
||
72 | * |
||
73 | * @return array cache configuration |
||
74 | */ |
||
75 | private static function getDefaults() |
||
90 | |||
91 | /** |
||
92 | * Create a default configuration file, used in installation |
||
93 | * |
||
94 | * SQLite is the recommended driver, and will be used by default if available. |
||
95 | * |
||
96 | * We will fall back to FileSystem if SQLite is not available. |
||
97 | * |
||
98 | * Note: some versions of the Stash FileSystem driver appear susceptible to |
||
99 | * race conditions which may cause random failures. |
||
100 | * |
||
101 | * Note for Windows users: |
||
102 | * |
||
103 | * When using Windows NTFS, PHP has a maximum path length of 260 bytes. Each key level in a |
||
104 | * Stash hierarchical key corresponds to a directory, and is normalized as an md5 hash. Also, |
||
105 | * Stash uses 2 levels for its own integrity and locking mechanisms. The full key length used |
||
106 | * in XoopCore can reach 202 characters. |
||
107 | * |
||
108 | * Installing the pdo_sqlite3 extension is highly recommended to avoid problems. |
||
109 | * |
||
110 | * @return void |
||
111 | */ |
||
112 | public static function createDefaultConfig() |
||
131 | |||
132 | /** |
||
133 | * Get a cache corresponding to the specified name |
||
134 | * |
||
135 | * @param string $name Name of cache definition |
||
136 | * |
||
137 | * @return Access object |
||
138 | */ |
||
139 | 29 | public function getCache($name) |
|
155 | |||
156 | /** |
||
157 | * Instantiate an Access object from named configuration, including |
||
158 | * instantiating pool and driver |
||
159 | * |
||
160 | * @param string $name name of pool configuration to start |
||
161 | * |
||
162 | * @return Access|false pool or false if a pool cannot be created |
||
163 | */ |
||
164 | protected function startPoolAccess($name) |
||
195 | |||
196 | /** |
||
197 | * getDriver |
||
198 | * |
||
199 | * @param string $driverName short name of the driver |
||
200 | * @param array $options array of options for the driver |
||
201 | * |
||
202 | * @return DriverInterface|false driver object or false if it could not be instantiated |
||
203 | */ |
||
204 | protected function getDriver($driverName, $options) |
||
215 | |||
216 | /** |
||
217 | * Get an Access object based on the default pool. If it isn't set, create it. |
||
218 | * If no definition exists for default, use Stash default (Ephimeral.) |
||
219 | * |
||
220 | * @param string $originalName originally requested pool configuration name |
||
221 | * |
||
222 | * @return Access object |
||
223 | */ |
||
224 | protected function getDefaultPool($originalName) |
||
239 | } |
||
240 |
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: