Update API in YaCache: MGET, EXISTS#6
Merged
YaCodesDevelopment merged 2 commits intomainfrom Jul 6, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR updates the YaCache API to change how multi-key fetches (MGet) and existence checks (Exists) behave and are surfaced to callers.
MGetnow returnsmap[string]*string(nil for missing values) instead of failing the entire operation.Existsaccepts multiple keys and returnstrueonly if all specified keys exist.- Redis and memory backends, along with their tests, are updated to match the new signatures and behaviors.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| yacache/yacache.go | Updated interface docs and signatures for MGet and Exists |
| yacache/redis.go | Changed MGet to return *string values; updated Exists to varargs |
| yacache/memory.go | Mirrored MGet and Exists signature and behavior changes |
| yacache/redis_test.go | Adjusted tests for pointer-valued MGet and multi-key Exists |
| yacache/memory_test.go | Adjusted tests for pointer-valued MGet |
Comments suppressed due to low confidence (3)
yacache/yacache.go:208
- The interface doc claims missing keys trigger an
ErrFailedToMGetValueserror, but implementations now return nil values per key without error. Please update the comment to match the actual behavior (nil entries for missing keys) or restore the all-or-nothing error behavior.
// If any of the keys are missing or the operation fails,
yacache/memory.go:353
- Add a doc comment above this method describing the new return type (
map[string]*string) and that missing keys yieldnilvalues rather than an error, mirroring the Redis implementation.
func (m *Memory) MGet(
yacache/redis_test.go:64
- In Go, you cannot range directly over an integer. Change this loop to something like
for i := 0; i < 10; i++ {}.
for i := range 10 {
YaCodesDevelopment
approved these changes
Jul 6, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.