Skip to content

[feature] Add putIfAbsent support - #8

Open
hooman-a9 wants to merge 3 commits into
Tosan:spring-boot3from
hooman-a9:feature/put-if-absent
Open

hooman-a9 wants to merge 3 commits into
Tosan:spring-boot3from
hooman-a9:feature/put-if-absent

Conversation

@hooman-a9

Copy link
Copy Markdown

No description provided.

@hooman-a9 hooman-a9 closed this Sep 6, 2026
@hooman-a9 hooman-a9 reopened this Sep 6, 2026
@memehri memehri self-assigned this Sep 8, 2026
@memehri
memehri self-requested a review September 8, 2026 16:24
@memehri memehri removed their assignment Sep 8, 2026
* @param timeToLive Item time to live
* @param timeUnit Time unit for time to live
*/
boolean addItemToHashIfAbsent(String cacheName, Object key, Object value, Long timeToLive, TimeUnit timeUnit);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think cacheName should not be part of this method's input.

If this is a hash-specific operation, the API should be something like:

addItemToHashIfAbsent(Object key, Object value, Long timeToLive, TimeUnit timeUnit)

The cache name should be resolved by the implementation/context rather than being passed by the caller.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep it uniform with other methods functionalities in TedissonLocalCacheManagerImpl (using cache methods and considering key as the cache name), I renamed the method name instead.

* @param timeToLive Item time to live
* @param timeUnit Time unit for time to live
*/
boolean addItemToCashIfAbsent(String cacheName, Object key, Object value, Long timeToLive, TimeUnit timeUnit);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change Cash to Cache in the method name:

addItemToCashIfAbsent

addItemToCacheIfAbsent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants