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