Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// LifeTime is lifespan for all entries
LifeTime uint64
// if exceed MaxLifeTime will force update
MaxLifeTime uint64
MaxEntries int
sync.RWMutex
// contains filtered or unexported fields
}
1. Keep entries available, trigger a update-key operation instead of purging entries out-of-date. 2. concurrent access safe 3. LRU
func NewCache ¶
func NewCache(lifeTime, maxlifeTime uint64, maxEntries int, updateKeyFunc UpdateKeyFunc) *Cache
NewCache creates a new Cache. auto flush cache to file if flushFile not "" and flushInterval > 0 for flush cache value must jsonable
type UpdateKeyFunc ¶
Click to show internal directories.
Click to hide internal directories.