This commit is contained in:
vitams 2021-06-07 20:00:53 +05:00
parent 82dc7e9bca
commit 5b9bc4754a
2 changed files with 5 additions and 5 deletions

View File

@ -16,7 +16,7 @@ type Item struct {
Expiration int64
}
// Returns true if the item has expired.
// Expired Returns true if the item has expired.
func (item Item) Expired() bool {
if item.Expiration == 0 {
return false
@ -25,9 +25,9 @@ func (item Item) Expired() bool {
}
const (
// For use with functions that take an expiration time.
// NoExpiration For use with functions that take an expiration time.
NoExpiration time.Duration = -1
// For use with functions that take an expiration time. Equivalent to
// DefaultExpiration For use with functions that take an expiration time. Equivalent to
// passing in the same expiration duration as was given to New() or
// NewFrom() when the cache was created (e.g. 5 minutes.)
DefaultExpiration time.Duration = 0
@ -46,7 +46,7 @@ type cache struct {
janitor *janitor
}
// Add an item to the cache, replacing any existing item. If the duration is 0
// Set Add an item to the cache, replacing any existing item. If the duration is 0
// (DefaultExpiration), the cache's default expiration time is used. If it is -1
// (NoExpiration), the item never expires.
func (c *cache) Set(k string, x interface{}, d time.Duration) {

2
go.mod
View File

@ -1,3 +1,3 @@
module github.com/vmpartner/go-cache
go 1.12
go 1.16