Skip to content

Conversation

connorcoco
Copy link
Contributor

@connorcoco connorcoco commented Apr 30, 2025

Description

This pull request updates the Javadoc of both RedisTemplate#keys() and RedisOperations#keys() methods to include a performance warning regarding the use of the KEYS command.

The KEYS command performs a full scan of the Redis keyspace, which can severely impact performance in production environments.
To avoid misuse, the updated Javadocs include a warning and recommend using scan(ScanOptions) as a safer alternative for large datasets.

  • The warning has been added to:
    • RedisTemplate#keys() implementation method.
    • RedisOperations#keys() interface method.

Note: ReactiveRedisOperations#keys() already contains a similar warning and did not require changes.


Checklist

  • I have read the Spring Data contribution guidelines.
  • I used the code formatters provided here and did not include any formatting-only changes.
  • No test cases were needed as this change is limited to documentation (Javadoc only).
  • No author header update was required since only a Javadoc comment was changed and no logic was modified.

References

@connorcoco connorcoco force-pushed the docs/keys-method-warning branch from 2cd631b to 23d1dd0 Compare April 30, 2025 05:44
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 30, 2025
@mp911de
Copy link
Member

mp911de commented May 5, 2025

Care to move this documentation bit to RedisOperations? And please cross-check ReactiveRedisOperations for the same mention.

@mp911de mp911de added type: documentation A documentation update and removed status: waiting-for-triage An issue we've not yet triaged labels May 5, 2025
@connorcoco
Copy link
Contributor Author

Care to move this documentation bit to RedisOperations? And please cross-check ReactiveRedisOperations for the same mention.

Thanks for the suggestion!
I reviewed ReactiveRedisOperations#keys() and confirmed it already includes a similar warning about performance concerns and recommends using scan().
Therefore, I only applied the Javadoc update to RedisOperations#keys().

@connorcoco connorcoco changed the title Add performance warning to RedisTemplate.keys() Javadoc Add performance warning to RedisTemplate#keys() and RedisOperations#keys() Javadoc May 6, 2025
christophstrobl added a commit that referenced this pull request Jun 10, 2025
Original Pull Request: #3142
christophstrobl added a commit that referenced this pull request Jul 2, 2025
Original Pull Request: #3142
mp911de pushed a commit that referenced this pull request Jul 9, 2025
Original Pull Request: #3142
mp911de pushed a commit that referenced this pull request Jul 10, 2025
mp911de pushed a commit that referenced this pull request Jul 10, 2025
mp911de pushed a commit that referenced this pull request Jul 10, 2025
mp911de pushed a commit that referenced this pull request Jul 10, 2025
@mp911de mp911de closed this in 447dc97 Jul 10, 2025
mp911de pushed a commit that referenced this pull request Jul 10, 2025
@mp911de mp911de added this to the 3.4.8 (2024.1.8) milestone Jul 10, 2025
@mp911de
Copy link
Member

mp911de commented Jul 10, 2025

Thank you for your contribution. That's merged, polished, and backported now.

@mp911de mp911de reopened this Jul 10, 2025
@mp911de mp911de closed this Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A documentation update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants