19 lines
306 B
Go
19 lines
306 B
Go
package memory
|
|
|
|
import "time"
|
|
|
|
// Item represents an item stored in the cache.
|
|
type Item struct {
|
|
Value any
|
|
Expiration int64
|
|
}
|
|
|
|
// Expired returns true if the item has expired.
|
|
func (i *Item) Expired() bool {
|
|
if i.Expiration == 0 {
|
|
return false
|
|
}
|
|
|
|
return time.Now().UnixNano() > i.Expiration
|
|
}
|