Skip to content

[redis] map redis.Nil to ErrKeyNotFound - #3

Merged
capcom6 merged 1 commit into
masterfrom
redis/redis-nil-mapping
Jul 10, 2026
Merged

[redis] map redis.Nil to ErrKeyNotFound#3
capcom6 merged 1 commit into
masterfrom
redis/redis-nil-mapping

Conversation

@capcom6

@capcom6 capcom6 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes
    • Improved cache lookups so missing Redis entries are now reported as a normal cache miss instead of an unexpected error.
    • Reduced noise in cache-related failures, making it easier for applications to handle missing data gracefully.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a49923d2-1fcc-4984-b781-f7c4127ffe9e

📥 Commits

Reviewing files that changed from the base of the PR and between 76bf782 and f35728a.

📒 Files selected for processing (1)
  • cache/redis.go

Walkthrough

RedisCache.Get now detects redis.Nil errors returned from the Lua Eval call and returns ErrKeyNotFound instead of the generic "failed to get cache item" error, providing explicit cache-miss handling for the atomic script path.

Changes

Redis Get cache-miss fix

Layer / File(s) Summary
Handle redis.Nil as cache miss
cache/redis.go
Added a check for errors.Is(err, redis.Nil) after the Lua Eval call in RedisCache.Get, returning ErrKeyNotFound instead of the generic error.

Estimated code review effort: 1 (Trivial) | ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the Redis cache change to map redis.Nil to ErrKeyNotFound.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@capcom6
capcom6 merged commit eb310ae into master Jul 10, 2026
5 checks passed
@capcom6
capcom6 deleted the redis/redis-nil-mapping branch July 10, 2026 03:59
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.

1 participant