ccache/item.go
2013-10-19 08:56:28 +08:00

22 lines
340 B
Go
Executable file

package ccache
import (
"sync"
"time"
"container/list"
)
type Item struct {
key string
value Value
sync.RWMutex
promoted time.Time
element *list.Element
}
func (i *Item) shouldPromote(staleness time.Duration) bool {
stale := time.Now().Add(staleness)
i.RLock()
defer i.RUnlock()
return i.promoted.Before(stale)
}