Skip to content

Commit 23d1dd0

Browse files
committed
Add performance warning to RedisTemplate.keys() Javadoc
Signed-off-by: JavaNo0b <[email protected]>
1 parent f4191e6 commit 23d1dd0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

+10
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,16 @@ public DataType type(K key) {
637637
return doWithKeys(connection -> connection.type(rawKey));
638638
}
639639

640+
/**
641+
* Retrieve keys matching the given pattern via {@code KEYS} command.
642+
* <p>
643+
* Note: This command scans the entire keyspace and may cause performance issues
644+
* in production environments. Prefer using {@link #scan(ScanOptions)} for large datasets.
645+
*
646+
* @param pattern key pattern
647+
* @return set of matching keys
648+
* @see <a href="https://redis.io/commands/keys">Redis KEYS command</a>
649+
*/
640650
@Override
641651
@SuppressWarnings("unchecked")
642652
public Set<K> keys(K pattern) {

0 commit comments

Comments
 (0)