Skip to content

Commit 447dc97

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

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
@@ -264,11 +264,14 @@ public interface RedisOperations<K, V> {
264264
DataType type(@NonNull K key);
265265

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

0 commit comments

Comments
 (0)