Skip to content

Added MGetCache helper in rueidiscompat#951

Closed
akshaykhairmode wants to merge 1 commit intoredis:mainfrom
akshaykhairmode:add-mget-cache-helper
Closed

Added MGetCache helper in rueidiscompat#951
akshaykhairmode wants to merge 1 commit intoredis:mainfrom
akshaykhairmode:add-mget-cache-helper

Conversation

@akshaykhairmode
Copy link
Contributor

Added MGetCache helper equivalent to compat.
Add new interface CacheCmdable.

Hello, Please review.

}

// MGetCache will internally call rueidis.MGetCache which only sends the keys to server which are not in cache.
func (c CacheCompat) MGetCache(ctx context.Context, keys ...string) *SliceCmd {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think there is no need for adding MGetCache to CacheCompat. Please just use rueidis.MGetCache.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

understood 👍

func (c *Compat) Cache(ttl time.Duration) CacheCompat {
return CacheCompat{client: c.client, ttl: ttl}
func (c *Compat) Cache(ttl time.Duration) CacheCmdable {
return &CacheCompat{client: c.client, ttl: ttl}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Returning the CacheCmdable struct is intentional to avoid unnecessary allocations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh, it will get moved to the heap right?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes.

@akshaykhairmode
Copy link
Contributor Author

Understood, closing this.

@akshaykhairmode akshaykhairmode deleted the add-mget-cache-helper branch February 9, 2026 05:52
@akshaykhairmode akshaykhairmode restored the add-mget-cache-helper branch February 9, 2026 07:01
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