Skip to content

Commit ca7dd40

Browse files
committed
review wording
1 parent d0d4e92 commit ca7dd40

2 files changed

Lines changed: 11 additions & 26 deletions

File tree

src/RedisCache.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838
*
3939
* @package RedisCache
4040
* @author Laurent LEGAZ <laurent@legaz.eu>
41+
* @version 1.0
42+
* @see https://redis.io/docs/latest/develop/data-types/#strings Redis Strings documentation
4143
*/
4244
class RedisCache extends RedisAdapter implements CacheInterface
4345
{
@@ -462,9 +464,9 @@ protected function checkKeyValidity(mixed &$key): void
462464
}
463465

464466
/**
465-
*filter also common forbidden characters between URL RFC and PSR-6/16 key definition
466-
* that is those 3: <code>\{}</code>, backslash and curly brackets
467-
* we use square brackets in IPv6 based URLs...
467+
* We filter also common forbidden characters between URL RFC and PSR-6/16 key definition,
468+
* that is those 3 chars: <code>\{}</code>, backslash and curly brackets.
469+
* We keep square brackets for use in IPv6 based URLs...
468470
*
469471
*/
470472
if (preg_match('/[\\\\{}]/', $key)) {

src/RedisEnhancedCache.php

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
* @author Laurent LEGAZ <laurent@legaz.eu>
7575
* @version 1.0
7676
* @see RedisCache Parent class providing base Redis functionality
77-
* @see https://redis.io/docs/data-types/hashes/ Redis Hash documentation
77+
* @see https://redis.io/docs/latest/develop/data-types/#hashes Redis Hash documentation
7878
*/
7979
class RedisEnhancedCache extends RedisCache
8080
{
@@ -96,16 +96,9 @@ class RedisEnhancedCache extends RedisCache
9696
* Stores multiple key-value pairs in a specified Redis Hash pool.
9797
*
9898
* This method allows batch insertion of cache entries into a named pool using Redis Hash operations.
99-
* All values are automatically serialized before storage to ensure consistency. The method uses
100-
* HMSET for multiple values and HSET for single values to optimize Redis operations.
101-
*
102-
* <b>Behavior:</b>
103-
* - For multiple values (count > 1): Uses Redis HMSET command
104-
* - For single value (count === 1): Uses Redis HSET command
105-
* - For empty array: Returns false without Redis operation
99+
* All values are automatically serialized before storage to ensure consistency.
106100
*
107101
* <b>Data Processing:</b>
108-
* - Keys are validated against PSR compliance rules (except for the ":" character which is accepted)
109102
* - Values are serialized using internal serialization mechanism
110103
* - Both keys and values undergo validation before storage
111104
*
@@ -193,15 +186,8 @@ public function storeToPool(array $values, string $pool = self::DEFAULT_POOL): b
193186
*
194187
* All retrieved values are automatically unserialized to restore their original data types.
195188
*
196-
* <b>Return Behavior:</b>
197-
* - Single key (string/int): Returns the value or DOES_NOT_EXIST constant
198-
* - Multiple keys (array): Returns associative array of key => value pairs
199-
* - Non-existent keys: Replaced with DOES_NOT_EXIST constant in results
200-
* - Invalid parameters: Throws InvalidKeyException
201-
*
202189
* <b>Data Processing:</b>
203190
* - Values are automatically deserialized upon retrieval
204-
* - String values are converted back to their original types
205191
* - Missing values are marked with DOES_NOT_EXIST constant
206192
* - Array results maintain key association from input
207193
*
@@ -273,12 +259,6 @@ public function fetchFromPool(mixed $key, string $pool = self::DEFAULT_POOL): mi
273259
* which is useful for conditional logic and validation operations. It uses Redis HEXISTS
274260
* command for optimal performance.
275261
*
276-
* <b>Implementation Notes:</b>
277-
* - Uses native Redis HEXISTS command for efficiency
278-
* - Handles adapter differences between php-redis and predis clients
279-
* - php-redis returns boolean true/false
280-
* - predis returns integer 1/0
281-
* - Both are normalized to boolean return value
282262
*
283263
* <b>Usage Examples:</b>
284264
* <code>
@@ -339,7 +319,6 @@ public function hasInPool(string $key, string $pool = self::DEFAULT_POOL): bool
339319
*
340320
* <b>Behavior:</b>
341321
* - Uses Redis HDEL for atomic deletion
342-
* - All keys are validated before deletion attempt
343322
* - Non-existent keys are silently ignored (not treated as errors)
344323
* - Returns true if Redis operation succeeds (even if some keys didn't exist)
345324
*
@@ -455,6 +434,10 @@ public function setHsetPoolExpiration(string $pool = self::DEFAULT_POOL, int $ex
455434
$redisResponse = -1;
456435

457436
if ($expirationTime > 0) {
437+
/**
438+
* <b>CRITICAL WARNING:</b>
439+
* Expiration applies to the ENTIRE pool !
440+
*/
458441
$redisResponse = $this->getRedis()->expire($pool, $expirationTime);
459442
}
460443

0 commit comments

Comments
 (0)