|
8 | 8 | * License: GNU/GPLv2
|
9 | 9 | * @see LICENSE.txt
|
10 | 10 | *
|
11 |
| - * This file: The loader (last modified: 2021.09.05). |
| 11 | + * This file: The loader (last modified: 2021.10.30). |
12 | 12 | */
|
13 | 13 |
|
14 | 14 | namespace phpMussel\Core;
|
@@ -1127,46 +1127,6 @@ public function hexSafe(string $Data): string
|
1127 | 1127 | return ($Data && !preg_match('/[^\da-f]/i', $Data) && !(strlen($Data) % 2)) ? hex2bin($Data) : '';
|
1128 | 1128 | }
|
1129 | 1129 |
|
1130 |
| - /** |
1131 |
| - * Initialise the cache. |
1132 |
| - * |
1133 |
| - * @throws Exception if using flatfiles for caching and if an appropriate |
1134 |
| - * cache directory hasn't been specified or can't be written to. |
1135 |
| - * @return void |
1136 |
| - */ |
1137 |
| - private function initialiseCache(): void |
1138 |
| - { |
1139 |
| - /** Exit early if already initialised. */ |
1140 |
| - if ($this->Cache instanceof \Maikuolan\Common\Cache) { |
1141 |
| - return; |
1142 |
| - } |
1143 |
| - |
1144 |
| - /** Create new cache object. */ |
1145 |
| - $this->Cache = new \Maikuolan\Common\Cache(); |
1146 |
| - $this->Cache->EnableAPCu = $this->Configuration['supplementary_cache_options']['enable_apcu']; |
1147 |
| - $this->Cache->EnableMemcached = $this->Configuration['supplementary_cache_options']['enable_memcached']; |
1148 |
| - $this->Cache->EnableRedis = $this->Configuration['supplementary_cache_options']['enable_redis']; |
1149 |
| - $this->Cache->EnablePDO = $this->Configuration['supplementary_cache_options']['enable_pdo']; |
1150 |
| - $this->Cache->MemcachedHost = $this->Configuration['supplementary_cache_options']['memcached_host']; |
1151 |
| - $this->Cache->MemcachedPort = $this->Configuration['supplementary_cache_options']['memcached_port']; |
1152 |
| - $this->Cache->RedisHost = $this->Configuration['supplementary_cache_options']['redis_host']; |
1153 |
| - $this->Cache->RedisPort = $this->Configuration['supplementary_cache_options']['redis_port']; |
1154 |
| - $this->Cache->RedisTimeout = $this->Configuration['supplementary_cache_options']['redis_timeout']; |
1155 |
| - $this->Cache->PDOdsn = $this->Configuration['supplementary_cache_options']['pdo_dsn']; |
1156 |
| - $this->Cache->PDOusername = $this->Configuration['supplementary_cache_options']['pdo_username']; |
1157 |
| - $this->Cache->PDOpassword = $this->Configuration['supplementary_cache_options']['pdo_password']; |
1158 |
| - |
1159 |
| - /** Assign cache path. */ |
1160 |
| - if ($this->CachePath) { |
1161 |
| - $this->Cache->FFDefault = $this->CachePath . DIRECTORY_SEPARATOR . 'cache.dat'; |
1162 |
| - } |
1163 |
| - |
1164 |
| - /** Attempt to connect. */ |
1165 |
| - if (!$this->Cache->connect()) { |
1166 |
| - throw new \Exception('Cache connect failed.'); |
1167 |
| - } |
1168 |
| - } |
1169 |
| - |
1170 | 1130 | /**
|
1171 | 1131 | * Fetch favicon.
|
1172 | 1132 | *
|
@@ -1316,4 +1276,44 @@ public function atHit(string $Hash, int $Size = -1, string $Name = '', string $T
|
1316 | 1276 | /** Update flags. */
|
1317 | 1277 | $this->InstanceCache['CheckWasLast'] = false;
|
1318 | 1278 | }
|
| 1279 | + |
| 1280 | + /** |
| 1281 | + * Initialise the cache. |
| 1282 | + * |
| 1283 | + * @throws Exception if using flatfiles for caching and if an appropriate |
| 1284 | + * cache directory hasn't been specified or can't be written to. |
| 1285 | + * @return void |
| 1286 | + */ |
| 1287 | + private function initialiseCache(): void |
| 1288 | + { |
| 1289 | + /** Exit early if already initialised. */ |
| 1290 | + if ($this->Cache instanceof \Maikuolan\Common\Cache) { |
| 1291 | + return; |
| 1292 | + } |
| 1293 | + |
| 1294 | + /** Create new cache object. */ |
| 1295 | + $this->Cache = new \Maikuolan\Common\Cache(); |
| 1296 | + $this->Cache->EnableAPCu = $this->Configuration['supplementary_cache_options']['enable_apcu']; |
| 1297 | + $this->Cache->EnableMemcached = $this->Configuration['supplementary_cache_options']['enable_memcached']; |
| 1298 | + $this->Cache->EnableRedis = $this->Configuration['supplementary_cache_options']['enable_redis']; |
| 1299 | + $this->Cache->EnablePDO = $this->Configuration['supplementary_cache_options']['enable_pdo']; |
| 1300 | + $this->Cache->MemcachedHost = $this->Configuration['supplementary_cache_options']['memcached_host']; |
| 1301 | + $this->Cache->MemcachedPort = $this->Configuration['supplementary_cache_options']['memcached_port']; |
| 1302 | + $this->Cache->RedisHost = $this->Configuration['supplementary_cache_options']['redis_host']; |
| 1303 | + $this->Cache->RedisPort = $this->Configuration['supplementary_cache_options']['redis_port']; |
| 1304 | + $this->Cache->RedisTimeout = $this->Configuration['supplementary_cache_options']['redis_timeout']; |
| 1305 | + $this->Cache->PDOdsn = $this->Configuration['supplementary_cache_options']['pdo_dsn']; |
| 1306 | + $this->Cache->PDOusername = $this->Configuration['supplementary_cache_options']['pdo_username']; |
| 1307 | + $this->Cache->PDOpassword = $this->Configuration['supplementary_cache_options']['pdo_password']; |
| 1308 | + |
| 1309 | + /** Assign cache path. */ |
| 1310 | + if ($this->CachePath) { |
| 1311 | + $this->Cache->FFDefault = $this->CachePath . DIRECTORY_SEPARATOR . 'cache.dat'; |
| 1312 | + } |
| 1313 | + |
| 1314 | + /** Attempt to connect. */ |
| 1315 | + if (!$this->Cache->connect()) { |
| 1316 | + throw new \Exception('Cache connect failed.'); |
| 1317 | + } |
| 1318 | + } |
1319 | 1319 | }
|
0 commit comments