Skip to content

Commit 28af64d

Browse files
connorcocomp911de
authored andcommitted
Add performance warning to RedisOperations#keys() Javadoc.
Closes #3142 Signed-off-by: JavaNo0b <[email protected]>
1 parent f5c7693 commit 28af64d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/main/java/org/springframework/data/redis/core/RedisOperations.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,14 @@ <T> T execute(RedisScript<T> script, RedisSerializer<?> argsSerializer, RedisSer
260260
DataType type(K key);
261261

262262
/**
263-
* Find all keys matching the given {@code pattern}.
264-
*
265-
* @param pattern must not be {@literal null}.
266-
* @return {@literal null} when used in pipeline / transaction.
267-
* @see <a href="https://redis.io/commands/keys">Redis Documentation: KEYS</a>
263+
* Retrieve keys matching the given pattern via {@code KEYS} command.
264+
* <p>
265+
* Note: This command scans the entire keyspace and may cause performance issues
266+
* in production environments. Prefer using {@link #scan(ScanOptions)} for large datasets.
267+
*
268+
* @param pattern key pattern
269+
* @return set of matching keys, or {@literal null} when used in pipeline / transaction
270+
* @see <a href="https://redis.io/commands/keys">Redis KEYS command</a>
268271
*/
269272
@Nullable
270273
Set<K> keys(K pattern);

0 commit comments

Comments
 (0)