Skip to content

Commit a597d3e

Browse files
connorcocochristophstrobl
authored andcommitted
Add performance warning to RedisOperations#keys() Javadoc
Signed-off-by: JavaNo0b <[email protected]>
1 parent adb23d6 commit a597d3e

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
@@ -262,11 +262,14 @@ <T> T execute(RedisScript<T> script, RedisSerializer<?> argsSerializer, RedisSer
262262
DataType type(K key);
263263

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

0 commit comments

Comments
 (0)