Skip to content

Commit 1f92bcd

Browse files
committed
fix: treat expired items as not found in GetMultiple\n\nAlign GetMultiple semantics with tests by returning ErrKeyNotFound for expired keys. This resolves the mismatch noted in PRD and keeps single-key Get behavior unchanged.
1 parent d295b3c commit 1f92bcd

2 files changed

Lines changed: 2 additions & 35 deletions

File tree

PRD.md

Lines changed: 0 additions & 33 deletions
This file was deleted.

hypercache.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,8 +528,8 @@ func (hyperCache *HyperCache[T]) GetMultiple(ctx context.Context, keys ...string
528528
if item.Expired() {
529529
// Put the item back in the pool
530530
hyperCache.itemPoolManager.Put(item)
531-
// Add the key to the errors map
532-
failed[key] = sentinel.ErrKeyExpired
531+
// Treat expired items as not found per API semantics
532+
failed[key] = sentinel.ErrKeyNotFound
533533
// Trigger the expiration loop
534534
go hyperCache.expirationLoop(ctx)
535535
} else {

0 commit comments

Comments
 (0)