♻️ Rename ErrInvalidDuration to ErrInvalidExpiry
This commit is contained in:
parent
a73435601c
commit
749033170d
2 changed files with 3 additions and 3 deletions
4
cache.go
4
cache.go
|
|
@ -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)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue