@@ -43,18 +43,18 @@ |
||
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | - * @var CacheLogger |
|
| 47 | - */ |
|
| 46 | + * @var CacheLogger |
|
| 47 | + */ |
|
| 48 | 48 | private $logger = null; |
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | - * @var FileCacheManager |
|
| 52 | - */ |
|
| 51 | + * @var FileCacheManager |
|
| 52 | + */ |
|
| 53 | 53 | private FileCacheManager $fileManager; |
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | - * @var FileCacheFlusher |
|
| 57 | - */ |
|
| 56 | + * @var FileCacheFlusher |
|
| 57 | + */ |
|
| 58 | 58 | private FileCacheFlusher $flusher; |
| 59 | 59 | |
| 60 | 60 | |
@@ -53,18 +53,18 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | - * @param string $filename |
|
| 57 | - * @return bool |
|
| 58 | - */ |
|
| 56 | + * @param string $filename |
|
| 57 | + * @return bool |
|
| 58 | + */ |
|
| 59 | 59 | public function fileExists(string $filename): bool |
| 60 | 60 | { |
| 61 | 61 | return file_exists($filename); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | - * @param string $filename |
|
| 66 | - * @return void |
|
| 67 | - */ |
|
| 65 | + * @param string $filename |
|
| 66 | + * @return void |
|
| 67 | + */ |
|
| 68 | 68 | public function removeFile(string $filename): void |
| 69 | 69 | { |
| 70 | 70 | if (file_exists($filename)) { |
@@ -73,9 +73,9 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | - * @param string $dir |
|
| 77 | - * @return void |
|
| 78 | - */ |
|
| 76 | + * @param string $dir |
|
| 77 | + * @return void |
|
| 78 | + */ |
|
| 79 | 79 | public function clearDirectory(string $dir): void |
| 80 | 80 | { |
| 81 | 81 | $iterator = new RecursiveIteratorIterator( |
@@ -14,42 +14,42 @@ |
||
| 14 | 14 | class RedisCacheManager |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - /** @var Predis\Client */ |
|
| 18 | - private static $redis; |
|
| 19 | - |
|
| 20 | - /** @param string $namespace */ |
|
| 21 | - private static $namespace; |
|
| 22 | - |
|
| 23 | - /** |
|
| 24 | - * Connects to the Redis server using the configuration defined in REDIS_CONNECTION_CONFIG. |
|
| 25 | - * |
|
| 26 | - * @return Client |
|
| 27 | - */ |
|
| 28 | - public static function connect() |
|
| 29 | - { |
|
| 17 | + /** @var Predis\Client */ |
|
| 18 | + private static $redis; |
|
| 19 | + |
|
| 20 | + /** @param string $namespace */ |
|
| 21 | + private static $namespace; |
|
| 22 | + |
|
| 23 | + /** |
|
| 24 | + * Connects to the Redis server using the configuration defined in REDIS_CONNECTION_CONFIG. |
|
| 25 | + * |
|
| 26 | + * @return Client |
|
| 27 | + */ |
|
| 28 | + public static function connect() |
|
| 29 | + { |
|
| 30 | 30 | Autoloader::register(); |
| 31 | 31 | self::$redis = new Client([ |
| 32 | - 'scheme' => 'tcp', |
|
| 33 | - 'host' => REDIS_CONNECTION_CONFIG['REDIS_HOST'], |
|
| 34 | - 'port' => REDIS_CONNECTION_CONFIG['REDIS_PORT'], |
|
| 35 | - 'password' => REDIS_CONNECTION_CONFIG['REDIS_PASSWORD'], |
|
| 36 | - 'database' => 0 |
|
| 32 | + 'scheme' => 'tcp', |
|
| 33 | + 'host' => REDIS_CONNECTION_CONFIG['REDIS_HOST'], |
|
| 34 | + 'port' => REDIS_CONNECTION_CONFIG['REDIS_PORT'], |
|
| 35 | + 'password' => REDIS_CONNECTION_CONFIG['REDIS_PASSWORD'], |
|
| 36 | + 'database' => 0 |
|
| 37 | 37 | ]); |
| 38 | 38 | self::auth(); |
| 39 | 39 | self::$namespace = REDIS_CONNECTION_CONFIG['REDIS_NAMESPACE'] ?? 'Cache'; |
| 40 | 40 | return self::$redis; |
| 41 | - } |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * Authenticates the Redis connection if a password is provided in the configuration. |
|
| 45 | - * |
|
| 46 | - * @return void |
|
| 47 | - */ |
|
| 48 | - private static function auth(): void |
|
| 49 | - { |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * Authenticates the Redis connection if a password is provided in the configuration. |
|
| 45 | + * |
|
| 46 | + * @return void |
|
| 47 | + */ |
|
| 48 | + private static function auth(): void |
|
| 49 | + { |
|
| 50 | 50 | if(is_string(REDIS_CONNECTION_CONFIG['REDIS_PASSWORD']) && REDIS_CONNECTION_CONFIG['REDIS_PASSWORD'] !== '') { |
| 51 | - self::$redis->auth(REDIS_CONNECTION_CONFIG['REDIS_PASSWORD']); |
|
| 51 | + self::$redis->auth(REDIS_CONNECTION_CONFIG['REDIS_PASSWORD']); |
|
| 52 | + } |
|
| 52 | 53 | } |
| 53 | - } |
|
| 54 | 54 | |
| 55 | 55 | } |
@@ -13,18 +13,18 @@ discard block |
||
| 13 | 13 | class FileCacheFlusher |
| 14 | 14 | { |
| 15 | 15 | /** |
| 16 | - * @var FileCacheManager |
|
| 17 | - */ |
|
| 16 | + * @var FileCacheManager |
|
| 17 | + */ |
|
| 18 | 18 | private FileCacheManager $fileManager; |
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | - * @var string $cacheDir |
|
| 22 | - */ |
|
| 21 | + * @var string $cacheDir |
|
| 22 | + */ |
|
| 23 | 23 | private string $cacheDir; |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | - * @var string $lastFlushTimeFile |
|
| 27 | - */ |
|
| 26 | + * @var string $lastFlushTimeFile |
|
| 27 | + */ |
|
| 28 | 28 | private string $lastFlushTimeFile; |
| 29 | 29 | |
| 30 | 30 | /** |
@@ -41,10 +41,10 @@ discard block |
||
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | - * Flushes all cache items and updates the last flush timestamp. |
|
| 45 | - * |
|
| 46 | - * @return void |
|
| 47 | - */ |
|
| 44 | + * Flushes all cache items and updates the last flush timestamp. |
|
| 45 | + * |
|
| 46 | + * @return void |
|
| 47 | + */ |
|
| 48 | 48 | public function flushCache(): void |
| 49 | 49 | { |
| 50 | 50 | $this->fileManager->clearDirectory($this->cacheDir); |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
| 55 | - * Handles the auto-flush functionality based on options. |
|
| 56 | - * |
|
| 57 | - * @param array $options |
|
| 58 | - * @return void |
|
| 59 | - */ |
|
| 55 | + * Handles the auto-flush functionality based on options. |
|
| 56 | + * |
|
| 57 | + * @param array $options |
|
| 58 | + * @return void |
|
| 59 | + */ |
|
| 60 | 60 | public function handleAutoFlush(array $options): void |
| 61 | 61 | { |
| 62 | 62 | if (isset($options['flushAfter'])) { |
@@ -60,11 +60,11 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | - * Retrieves cache data from the database. |
|
| 64 | - * |
|
| 65 | - * @param string $cacheKey |
|
| 66 | - * @param string $namespace |
|
| 67 | - * @return mixed |
|
| 63 | + * Retrieves cache data from the database. |
|
| 64 | + * |
|
| 65 | + * @param string $cacheKey |
|
| 66 | + * @param string $namespace |
|
| 67 | + * @return mixed |
|
| 68 | 68 | */ |
| 69 | 69 | public function retrieve(string $cacheKey, string $namespace = ''): mixed |
| 70 | 70 | { |
@@ -109,10 +109,10 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | /** |
| 112 | - * Get Update query based on the database driver. |
|
| 113 | - * |
|
| 114 | - * @return string |
|
| 115 | - */ |
|
| 112 | + * Get Update query based on the database driver. |
|
| 113 | + * |
|
| 114 | + * @return string |
|
| 115 | + */ |
|
| 116 | 116 | private function getUpdateQueryWithDriver(): string |
| 117 | 117 | { |
| 118 | 118 | $driver = $this->connection->getAttribute(PDO::ATTR_DRIVER_NAME); |
@@ -123,10 +123,10 @@ discard block |
||
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
| 126 | - * Get Delete query based on the database driver. |
|
| 127 | - * |
|
| 128 | - * @return string |
|
| 129 | - */ |
|
| 126 | + * Get Delete query based on the database driver. |
|
| 127 | + * |
|
| 128 | + * @return string |
|
| 129 | + */ |
|
| 130 | 130 | private function getDeleteQueryWithDriver(): string |
| 131 | 131 | { |
| 132 | 132 | $driver = $this->connection->getAttribute(PDO::ATTR_DRIVER_NAME); |
@@ -137,13 +137,13 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
| 140 | - * Updates an existing cache item in the database. |
|
| 141 | - * |
|
| 142 | - * @param string $cacheKey |
|
| 143 | - * @param mixed $cacheData |
|
| 144 | - * @param string $namespace |
|
| 145 | - * @return bool |
|
| 146 | - */ |
|
| 140 | + * Updates an existing cache item in the database. |
|
| 141 | + * |
|
| 142 | + * @param string $cacheKey |
|
| 143 | + * @param mixed $cacheData |
|
| 144 | + * @param string $namespace |
|
| 145 | + * @return bool |
|
| 146 | + */ |
|
| 147 | 147 | public function update(string $cacheKey, mixed $cacheData, string $namespace = ''): bool |
| 148 | 148 | { |
| 149 | 149 | $query = $this->getUpdateQueryWithDriver(); |
@@ -157,12 +157,12 @@ discard block |
||
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
| 160 | - * Clears a specific cache item from the database. |
|
| 161 | - * |
|
| 162 | - * @param string $cacheKey |
|
| 163 | - * @param string $namespace |
|
| 164 | - * @return bool |
|
| 165 | - */ |
|
| 160 | + * Clears a specific cache item from the database. |
|
| 161 | + * |
|
| 162 | + * @param string $cacheKey |
|
| 163 | + * @param string $namespace |
|
| 164 | + * @return bool |
|
| 165 | + */ |
|
| 166 | 166 | public function clear(string $cacheKey, string $namespace = ''): bool |
| 167 | 167 | { |
| 168 | 168 | $query = $this->getDeleteQueryWithDriver(); |
@@ -175,10 +175,10 @@ discard block |
||
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
| 178 | - * Gets the query to renew the expiration time of a cache item based on the database driver. |
|
| 179 | - * |
|
| 180 | - * @return string |
|
| 181 | - */ |
|
| 178 | + * Gets the query to renew the expiration time of a cache item based on the database driver. |
|
| 179 | + * |
|
| 180 | + * @return string |
|
| 181 | + */ |
|
| 182 | 182 | private function getRenewExpirationQueryWithDriver(): string |
| 183 | 183 | { |
| 184 | 184 | $driver = $this->connection->getAttribute(PDO::ATTR_DRIVER_NAME); |
@@ -193,13 +193,13 @@ discard block |
||
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | /** |
| 196 | - * Checks if a cache item is valid based on its key, namespace, and current time. |
|
| 197 | - * |
|
| 198 | - * @param string $cacheKey |
|
| 199 | - * @param string $namespace |
|
| 200 | - * @param string $currentTime |
|
| 201 | - * @return bool |
|
| 202 | - */ |
|
| 196 | + * Checks if a cache item is valid based on its key, namespace, and current time. |
|
| 197 | + * |
|
| 198 | + * @param string $cacheKey |
|
| 199 | + * @param string $namespace |
|
| 200 | + * @param string $currentTime |
|
| 201 | + * @return bool |
|
| 202 | + */ |
|
| 203 | 203 | private function hasValidCache(string $cacheKey, string $namespace, string $currentTime): bool |
| 204 | 204 | { |
| 205 | 205 | $stmt = $this->connection->prepare( |
@@ -215,13 +215,13 @@ discard block |
||
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | /** |
| 218 | - * Renews the expiration time of a cache item. |
|
| 219 | - * |
|
| 220 | - * @param string $cacheKey |
|
| 221 | - * @param string|int $ttl |
|
| 222 | - * @param string $namespace |
|
| 223 | - * @return bool |
|
| 224 | - */ |
|
| 218 | + * Renews the expiration time of a cache item. |
|
| 219 | + * |
|
| 220 | + * @param string $cacheKey |
|
| 221 | + * @param string|int $ttl |
|
| 222 | + * @param string $namespace |
|
| 223 | + * @return bool |
|
| 224 | + */ |
|
| 225 | 225 | public function renew(string $cacheKey, string|int $ttl, string $namespace = ''): bool |
| 226 | 226 | { |
| 227 | 227 | $currentTime = date('Y-m-d H:i:s'); |
@@ -241,10 +241,10 @@ discard block |
||
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | /** |
| 244 | - * Flushes all cache items from the database. |
|
| 245 | - * |
|
| 246 | - * @return bool |
|
| 247 | - */ |
|
| 244 | + * Flushes all cache items from the database. |
|
| 245 | + * |
|
| 246 | + * @return bool |
|
| 247 | + */ |
|
| 248 | 248 | public function flush(): bool |
| 249 | 249 | { |
| 250 | 250 | return $this->connection->exec("DELETE FROM cacheer_table") !== false; |
@@ -263,11 +263,11 @@ discard block |
||
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | /** |
| 266 | - * Gets the current date and time based on the database driver. |
|
| 267 | - * |
|
| 268 | - * @param string $driver |
|
| 269 | - * @return string |
|
| 270 | - */ |
|
| 266 | + * Gets the current date and time based on the database driver. |
|
| 267 | + * |
|
| 268 | + * @param string $driver |
|
| 269 | + * @return string |
|
| 270 | + */ |
|
| 271 | 271 | private function getCurrentDateTime(string $driver): string |
| 272 | 272 | { |
| 273 | 273 | return ($driver === 'sqlite') ? "DATETIME('now', 'localtime')" : "NOW()"; |
@@ -12,13 +12,13 @@ |
||
| 12 | 12 | class OptionBuilder |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Creates a FileOptionBuilder instance for file-based cache options. |
|
| 17 | - * |
|
| 18 | - * @return FileOptionBuilder |
|
| 19 | - */ |
|
| 20 | - public static function forFile(): FileOptionBuilder |
|
| 21 | - { |
|
| 15 | + /** |
|
| 16 | + * Creates a FileOptionBuilder instance for file-based cache options. |
|
| 17 | + * |
|
| 18 | + * @return FileOptionBuilder |
|
| 19 | + */ |
|
| 20 | + public static function forFile(): FileOptionBuilder |
|
| 21 | + { |
|
| 22 | 22 | return new FileOptionBuilder(); |
| 23 | - } |
|
| 23 | + } |
|
| 24 | 24 | } |
@@ -16,15 +16,15 @@ |
||
| 16 | 16 | class CacheRetriever |
| 17 | 17 | { |
| 18 | 18 | /** |
| 19 | - * @var Cacheer |
|
| 20 | - */ |
|
| 19 | + * @var Cacheer |
|
| 20 | + */ |
|
| 21 | 21 | private Cacheer $cacheer; |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | - * CacheRetriever constructor. |
|
| 25 | - * |
|
| 26 | - * @param Cacheer $cacheer |
|
| 27 | - */ |
|
| 24 | + * CacheRetriever constructor. |
|
| 25 | + * |
|
| 26 | + * @param Cacheer $cacheer |
|
| 27 | + */ |
|
| 28 | 28 | public function __construct(Cacheer $cacheer) |
| 29 | 29 | { |
| 30 | 30 | $this->cacheer = $cacheer; |
@@ -13,24 +13,24 @@ discard block |
||
| 13 | 13 | class TimeBuilder |
| 14 | 14 | { |
| 15 | 15 | |
| 16 | - /** @param Closure $callback */ |
|
| 17 | - private Closure $callback; |
|
| 16 | + /** @param Closure $callback */ |
|
| 17 | + private Closure $callback; |
|
| 18 | 18 | |
| 19 | - /** @var ?FileOptionBuilder */ |
|
| 20 | - private ?FileOptionBuilder $builder = null; |
|
| 19 | + /** @var ?FileOptionBuilder */ |
|
| 20 | + private ?FileOptionBuilder $builder = null; |
|
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * TimeBuilder constructor. |
|
| 24 | - * @param Closure $callback |
|
| 25 | - * @param FileOptionBuilder $builder |
|
| 26 | - * |
|
| 27 | - * @return void |
|
| 28 | - */ |
|
| 29 | - public function __construct(Closure $callback, FileOptionBuilder $builder) |
|
| 30 | - { |
|
| 22 | + /** |
|
| 23 | + * TimeBuilder constructor. |
|
| 24 | + * @param Closure $callback |
|
| 25 | + * @param FileOptionBuilder $builder |
|
| 26 | + * |
|
| 27 | + * @return void |
|
| 28 | + */ |
|
| 29 | + public function __construct(Closure $callback, FileOptionBuilder $builder) |
|
| 30 | + { |
|
| 31 | 31 | $this->callback = $callback; |
| 32 | 32 | $this->builder = $builder; |
| 33 | - } |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * Sets the time in seconds. |
@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | * @param int $seconds |
| 39 | 39 | * @return FileOptionBuilder|null |
| 40 | 40 | */ |
| 41 | - public function second(int $seconds): ?FileOptionBuilder |
|
| 42 | - { |
|
| 41 | + public function second(int $seconds): ?FileOptionBuilder |
|
| 42 | + { |
|
| 43 | 43 | return $this->setTime($seconds, "seconds"); |
| 44 | - } |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * Sets the time in minutes. |
@@ -49,10 +49,10 @@ discard block |
||
| 49 | 49 | * @param int $minutes |
| 50 | 50 | * @return FileOptionBuilder|null |
| 51 | 51 | */ |
| 52 | - public function minute(int $minutes): ?FileOptionBuilder |
|
| 53 | - { |
|
| 52 | + public function minute(int $minutes): ?FileOptionBuilder |
|
| 53 | + { |
|
| 54 | 54 | return $this->setTime($minutes, "minutes"); |
| 55 | - } |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * Sets the time in hours. |
@@ -60,10 +60,10 @@ discard block |
||
| 60 | 60 | * @param int $hours |
| 61 | 61 | * @return FileOptionBuilder|null |
| 62 | 62 | */ |
| 63 | - public function hour(int $hours): ?FileOptionBuilder |
|
| 64 | - { |
|
| 63 | + public function hour(int $hours): ?FileOptionBuilder |
|
| 64 | + { |
|
| 65 | 65 | return $this->setTime($hours, "hours"); |
| 66 | - } |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * Sets the time in days. |
@@ -71,10 +71,10 @@ discard block |
||
| 71 | 71 | * @param int $days |
| 72 | 72 | * @return FileOptionBuilder|null |
| 73 | 73 | */ |
| 74 | - public function day(int $days): ?FileOptionBuilder |
|
| 75 | - { |
|
| 74 | + public function day(int $days): ?FileOptionBuilder |
|
| 75 | + { |
|
| 76 | 76 | return $this->setTime($days, "days"); |
| 77 | - } |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | 80 | * Sets the time in weeks. |
@@ -82,10 +82,10 @@ discard block |
||
| 82 | 82 | * @param int $weeks |
| 83 | 83 | * @return FileOptionBuilder|null |
| 84 | 84 | */ |
| 85 | - public function week(int $weeks): ?FileOptionBuilder |
|
| 86 | - { |
|
| 85 | + public function week(int $weeks): ?FileOptionBuilder |
|
| 86 | + { |
|
| 87 | 87 | return $this->setTime($weeks, "weeks"); |
| 88 | - } |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | 90 | /** |
| 91 | 91 | * Sets the time in months. |
@@ -93,10 +93,10 @@ discard block |
||
| 93 | 93 | * @param int $months |
| 94 | 94 | * @return FileOptionBuilder|null |
| 95 | 95 | */ |
| 96 | - public function month(int $months): ?FileOptionBuilder |
|
| 97 | - { |
|
| 96 | + public function month(int $months): ?FileOptionBuilder |
|
| 97 | + { |
|
| 98 | 98 | return $this->setTime($months, "months"); |
| 99 | - } |
|
| 99 | + } |
|
| 100 | 100 | |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -106,10 +106,10 @@ discard block |
||
| 106 | 106 | * @param string $unit |
| 107 | 107 | * @return FileOptionBuilder|null |
| 108 | 108 | */ |
| 109 | - private function setTime(int $value, string $unit): ?FileOptionBuilder |
|
| 110 | - { |
|
| 111 | - ($this->callback)("{$value} {$unit}"); |
|
| 109 | + private function setTime(int $value, string $unit): ?FileOptionBuilder |
|
| 110 | + { |
|
| 111 | + ($this->callback)("{$value} {$unit}"); |
|
| 112 | 112 | return $this->builder; |
| 113 | - } |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | 115 | } |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | { |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | - * @var Cacheer |
|
| 24 | - */ |
|
| 23 | + * @var Cacheer |
|
| 24 | + */ |
|
| 25 | 25 | protected Cacheer $cacheer; |
| 26 | 26 | |
| 27 | 27 | /** @param string $logPath */ |
@@ -38,10 +38,10 @@ discard block |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | - * Uses the database driver for caching. |
|
| 42 | - * |
|
| 43 | - * @return Cacheer |
|
| 44 | - */ |
|
| 41 | + * Uses the database driver for caching. |
|
| 42 | + * |
|
| 43 | + * @return Cacheer |
|
| 44 | + */ |
|
| 45 | 45 | public function useDatabaseDriver(): Cacheer |
| 46 | 46 | { |
| 47 | 47 | $this->cacheer->cacheStore = new DatabaseCacheStore($this->logPath); |
@@ -49,10 +49,10 @@ discard block |
||
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | - * Uses the file driver for caching. |
|
| 53 | - * |
|
| 54 | - * @return Cacheer |
|
| 55 | - */ |
|
| 52 | + * Uses the file driver for caching. |
|
| 53 | + * |
|
| 54 | + * @return Cacheer |
|
| 55 | + */ |
|
| 56 | 56 | public function useFileDriver(): Cacheer |
| 57 | 57 | { |
| 58 | 58 | $this->cacheer->options['loggerPath'] = $this->logPath; |
@@ -61,10 +61,10 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | - * Uses the Redis driver for caching. |
|
| 65 | - * |
|
| 66 | - * @return Cacheer |
|
| 67 | - */ |
|
| 64 | + * Uses the Redis driver for caching. |
|
| 65 | + * |
|
| 66 | + * @return Cacheer |
|
| 67 | + */ |
|
| 68 | 68 | public function useRedisDriver(): Cacheer |
| 69 | 69 | { |
| 70 | 70 | $this->cacheer->cacheStore = new RedisCacheStore($this->logPath); |
@@ -72,10 +72,10 @@ discard block |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | - * Uses the array driver for caching. |
|
| 76 | - * |
|
| 77 | - * @return Cacheer |
|
| 78 | - */ |
|
| 75 | + * Uses the array driver for caching. |
|
| 76 | + * |
|
| 77 | + * @return Cacheer |
|
| 78 | + */ |
|
| 79 | 79 | public function useArrayDriver(): Cacheer |
| 80 | 80 | { |
| 81 | 81 | $this->cacheer->cacheStore = new ArrayCacheStore($this->logPath); |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | - * Uses the default driver for caching. |
|
| 87 | - * |
|
| 88 | - * @return Cacheer |
|
| 89 | - */ |
|
| 86 | + * Uses the default driver for caching. |
|
| 87 | + * |
|
| 88 | + * @return Cacheer |
|
| 89 | + */ |
|
| 90 | 90 | public function useDefaultDriver(): Cacheer |
| 91 | 91 | { |
| 92 | 92 | if (!isset($this->cacheer->options['cacheDir'])) { |
@@ -103,16 +103,16 @@ discard block |
||
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | - * Checks if the directory exists or creates it. |
|
| 107 | - * |
|
| 108 | - * @param mixed $dirName |
|
| 109 | - * @return bool |
|
| 110 | - */ |
|
| 106 | + * Checks if the directory exists or creates it. |
|
| 107 | + * |
|
| 108 | + * @param mixed $dirName |
|
| 109 | + * @return bool |
|
| 110 | + */ |
|
| 111 | 111 | private function isDir(mixed $dirName): bool |
| 112 | 112 | { |
| 113 | - if (is_dir($dirName)) { |
|
| 114 | - return true; |
|
| 115 | - } |
|
| 116 | - return mkdir($dirName, 0755, true); |
|
| 113 | + if (is_dir($dirName)) { |
|
| 114 | + return true; |
|
| 115 | + } |
|
| 116 | + return mkdir($dirName, 0755, true); |
|
| 117 | 117 | } |
| 118 | 118 | } |