@@ -67,66 +67,66 @@ discard block |
||
| 67 | 67 | final class Cacheer |
| 68 | 68 | { |
| 69 | 69 | /** |
| 70 | - * @var string |
|
| 71 | - */ |
|
| 70 | + * @var string |
|
| 71 | + */ |
|
| 72 | 72 | private string $message; |
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | - * @var boolean |
|
| 76 | - */ |
|
| 75 | + * @var boolean |
|
| 76 | + */ |
|
| 77 | 77 | private bool $success; |
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | - * @var boolean |
|
| 81 | - */ |
|
| 80 | + * @var boolean |
|
| 81 | + */ |
|
| 82 | 82 | private bool $formatted = false; |
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | - * @var bool |
|
| 86 | - */ |
|
| 85 | + * @var bool |
|
| 86 | + */ |
|
| 87 | 87 | private bool $compression = false; |
| 88 | 88 | |
| 89 | 89 | /** |
| 90 | - * @var string|null |
|
| 91 | - */ |
|
| 90 | + * @var string|null |
|
| 91 | + */ |
|
| 92 | 92 | private ?string $encryptionKey = null; |
| 93 | 93 | |
| 94 | 94 | /** |
| 95 | - * @var FileCacheStore|DatabaseCacheStore|RedisCacheStore|ArrayCacheStore |
|
| 96 | - */ |
|
| 95 | + * @var FileCacheStore|DatabaseCacheStore|RedisCacheStore|ArrayCacheStore |
|
| 96 | + */ |
|
| 97 | 97 | public RedisCacheStore|DatabaseCacheStore|ArrayCacheStore|FileCacheStore $cacheStore; |
| 98 | 98 | |
| 99 | 99 | /** |
| 100 | - * @var array |
|
| 101 | - */ |
|
| 100 | + * @var array |
|
| 101 | + */ |
|
| 102 | 102 | public array $options = []; |
| 103 | 103 | |
| 104 | 104 | /** |
| 105 | - * @var CacheRetriever |
|
| 106 | - */ |
|
| 105 | + * @var CacheRetriever |
|
| 106 | + */ |
|
| 107 | 107 | private CacheRetriever $retriever; |
| 108 | 108 | |
| 109 | 109 | /** |
| 110 | - * @var CacheMutator |
|
| 111 | - */ |
|
| 110 | + * @var CacheMutator |
|
| 111 | + */ |
|
| 112 | 112 | private CacheMutator $mutator; |
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | - * @var CacheConfig |
|
| 116 | - */ |
|
| 115 | + * @var CacheConfig |
|
| 116 | + */ |
|
| 117 | 117 | private CacheConfig $config; |
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | - * @var Cacheer|null |
|
| 121 | - */ |
|
| 120 | + * @var Cacheer|null |
|
| 121 | + */ |
|
| 122 | 122 | private static ?Cacheer $staticInstance = null; |
| 123 | 123 | |
| 124 | 124 | /** |
| 125 | - * Cacheer constructor. |
|
| 126 | - * |
|
| 127 | - * @param array $options |
|
| 128 | - * @param bool $formatted |
|
| 129 | - * @throws RuntimeException|Exceptions\CacheFileException |
|
| 125 | + * Cacheer constructor. |
|
| 126 | + * |
|
| 127 | + * @param array $options |
|
| 128 | + * @param bool $formatted |
|
| 129 | + * @throws RuntimeException|Exceptions\CacheFileException |
|
| 130 | 130 | */ |
| 131 | 131 | public function __construct(array $options = [], bool $formatted = false) |
| 132 | 132 | { |
@@ -186,11 +186,11 @@ discard block |
||
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /** |
| 189 | - * Enable encryption for cached data |
|
| 190 | - * |
|
| 191 | - * @param string $key |
|
| 192 | - * @return Cacheer |
|
| 193 | - */ |
|
| 189 | + * Enable encryption for cached data |
|
| 190 | + * |
|
| 191 | + * @param string $key |
|
| 192 | + * @return Cacheer |
|
| 193 | + */ |
|
| 194 | 194 | public static function useEncryption(string $key): Cacheer |
| 195 | 195 | { |
| 196 | 196 | $instance = self::instance(); |
@@ -199,11 +199,11 @@ discard block |
||
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | /** |
| 202 | - * Enable or disable data compression |
|
| 203 | - * |
|
| 204 | - * @param bool $status |
|
| 205 | - * @return Cacheer |
|
| 206 | - */ |
|
| 202 | + * Enable or disable data compression |
|
| 203 | + * |
|
| 204 | + * @param bool $status |
|
| 205 | + * @return Cacheer |
|
| 206 | + */ |
|
| 207 | 207 | public static function useCompression(bool $status = true): Cacheer |
| 208 | 208 | { |
| 209 | 209 | $instance = self::instance(); |
@@ -212,10 +212,10 @@ discard block |
||
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | /** |
| 215 | - * Enables or disables the formatter for cache data. |
|
| 216 | - * |
|
| 217 | - * @return void |
|
| 218 | - */ |
|
| 215 | + * Enables or disables the formatter for cache data. |
|
| 216 | + * |
|
| 217 | + * @return void |
|
| 218 | + */ |
|
| 219 | 219 | public static function useFormatter(): void |
| 220 | 220 | { |
| 221 | 221 | $instance = self::instance(); |
@@ -223,33 +223,33 @@ discard block |
||
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | /** |
| 226 | - * Validates the options provided for the Cacheer instance. |
|
| 227 | - * |
|
| 228 | - * @param array $options |
|
| 229 | - * @return void |
|
| 230 | - */ |
|
| 226 | + * Validates the options provided for the Cacheer instance. |
|
| 227 | + * |
|
| 228 | + * @param array $options |
|
| 229 | + * @return void |
|
| 230 | + */ |
|
| 231 | 231 | private function validateOptions(array $options): void |
| 232 | 232 | { |
| 233 | 233 | $this->options = $options; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | /** |
| 237 | - * Checks if the last operation was successful. |
|
| 238 | - * |
|
| 239 | - * @return bool |
|
| 240 | - */ |
|
| 237 | + * Checks if the last operation was successful. |
|
| 238 | + * |
|
| 239 | + * @return bool |
|
| 240 | + */ |
|
| 241 | 241 | public static function isSuccess(): bool |
| 242 | 242 | { |
| 243 | 243 | return self::instance()->success; |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /** |
| 247 | - * Sets a message for the cache operation. |
|
| 248 | - * |
|
| 249 | - * @param string $message |
|
| 250 | - * @param boolean $success |
|
| 251 | - * @return void |
|
| 252 | - */ |
|
| 247 | + * Sets a message for the cache operation. |
|
| 248 | + * |
|
| 249 | + * @param string $message |
|
| 250 | + * @param boolean $success |
|
| 251 | + * @return void |
|
| 252 | + */ |
|
| 253 | 253 | private function setMessage(string $message, bool $success): void |
| 254 | 254 | { |
| 255 | 255 | $this->message = $message; |
@@ -257,10 +257,10 @@ discard block |
||
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | /** |
| 260 | - * Retrieves the message from the last operation. |
|
| 261 | - * |
|
| 262 | - * @return string |
|
| 263 | - */ |
|
| 260 | + * Retrieves the message from the last operation. |
|
| 261 | + * |
|
| 262 | + * @return string |
|
| 263 | + */ |
|
| 264 | 264 | public static function getMessage(): string |
| 265 | 265 | { |
| 266 | 266 | return self::instance()->message; |