♻️ Rename ErrInvalidDuration to ErrInvalidExpiry

This commit is contained in:
Dan Jones 2025-04-21 11:24:51 -05:00
commit 749033170d
2 changed files with 3 additions and 3 deletions

View file

@ -9,9 +9,9 @@ import (
// This is probably only going to happen if it's nil. // This is probably only going to happen if it's nil.
var ErrInvalidFetcher = errors.New("invalid fetcher") var ErrInvalidFetcher = errors.New("invalid fetcher")
// ErrInvalidDuration is returned by Cache.SetExpiry if the duration is invalid. // ErrInvalidExpiry is returned by Cache.SetExpiry if the duration is invalid.
// This is usually if it is <= 0. // This is usually if it is <= 0.
var ErrInvalidDuration = errors.New("invalid duration") var ErrInvalidExpiry = errors.New("invalid duration")
type Fetcher[K comparable, V any] func(K) (V, error) type Fetcher[K comparable, V any] func(K) (V, error)

View file

@ -45,7 +45,7 @@ func (c *ezc[K, V]) SetFetcher(f Fetcher[K, V]) error {
func (c *ezc[K, V]) SetExpiry(exp time.Duration) error { func (c *ezc[K, V]) SetExpiry(exp time.Duration) error {
if exp <= 0 { if exp <= 0 {
return ErrInvalidDuration return ErrInvalidExpiry
} }
c.exp = exp c.exp = exp
return nil return nil