@@ -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 function useEncryption(string $key): Cacheer |
| 195 | 195 | { |
| 196 | 196 | $this->encryptionKey = $key; |
@@ -198,11 +198,11 @@ discard block |
||
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | /** |
| 201 | - * Enable or disable data compression |
|
| 202 | - * |
|
| 203 | - * @param bool $status |
|
| 204 | - * @return Cacheer |
|
| 205 | - */ |
|
| 201 | + * Enable or disable data compression |
|
| 202 | + * |
|
| 203 | + * @param bool $status |
|
| 204 | + * @return Cacheer |
|
| 205 | + */ |
|
| 206 | 206 | public function useCompression(bool $status = true): Cacheer |
| 207 | 207 | { |
| 208 | 208 | $this->compression = $status; |
@@ -210,43 +210,43 @@ discard block |
||
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | /** |
| 213 | - * Enables or disables the formatter for cache data. |
|
| 214 | - * |
|
| 215 | - * @return void |
|
| 216 | - */ |
|
| 213 | + * Enables or disables the formatter for cache data. |
|
| 214 | + * |
|
| 215 | + * @return void |
|
| 216 | + */ |
|
| 217 | 217 | public function useFormatter(): void |
| 218 | 218 | { |
| 219 | 219 | $this->formatted = !$this->formatted; |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | /** |
| 223 | - * Validates the options provided for the Cacheer instance. |
|
| 224 | - * |
|
| 225 | - * @param array $options |
|
| 226 | - * @return void |
|
| 227 | - */ |
|
| 223 | + * Validates the options provided for the Cacheer instance. |
|
| 224 | + * |
|
| 225 | + * @param array $options |
|
| 226 | + * @return void |
|
| 227 | + */ |
|
| 228 | 228 | private function validateOptions(array $options): void |
| 229 | 229 | { |
| 230 | 230 | $this->options = $options; |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | /** |
| 234 | - * Checks if the last operation was successful. |
|
| 235 | - * |
|
| 236 | - * @return bool |
|
| 237 | - */ |
|
| 234 | + * Checks if the last operation was successful. |
|
| 235 | + * |
|
| 236 | + * @return bool |
|
| 237 | + */ |
|
| 238 | 238 | public function isSuccess(): bool |
| 239 | 239 | { |
| 240 | 240 | return $this->success; |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | /** |
| 244 | - * Sets a message for the cache operation. |
|
| 245 | - * |
|
| 246 | - * @param string $message |
|
| 247 | - * @param boolean $success |
|
| 248 | - * @return void |
|
| 249 | - */ |
|
| 244 | + * Sets a message for the cache operation. |
|
| 245 | + * |
|
| 246 | + * @param string $message |
|
| 247 | + * @param boolean $success |
|
| 248 | + * @return void |
|
| 249 | + */ |
|
| 250 | 250 | private function setMessage(string $message, bool $success): void |
| 251 | 251 | { |
| 252 | 252 | $this->message = $message; |
@@ -254,10 +254,10 @@ discard block |
||
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | /** |
| 257 | - * Retrieves the message from the last operation. |
|
| 258 | - * |
|
| 259 | - * @return string |
|
| 260 | - */ |
|
| 257 | + * Retrieves the message from the last operation. |
|
| 258 | + * |
|
| 259 | + * @return string |
|
| 260 | + */ |
|
| 261 | 261 | public function getMessage(): string |
| 262 | 262 | { |
| 263 | 263 | return $this->message; |