Documentation ¶
Index ¶
- Constants
- Variables
- type CacheCoherent
- func (cc *CacheCoherent) Delay(key, val any, ttl time.Duration)
- func (cc *CacheCoherent) Forever(key, val any)
- func (cc *CacheCoherent) Forget(key any)
- func (cc *CacheCoherent) Have(key any) bool
- func (cc *CacheCoherent) Inactive(key, val any, inactive time.Duration)
- func (cc *CacheCoherent) Read(key any) (any, bool)
- func (cc *CacheCoherent) Reset()
- func (cc *CacheCoherent) SetScanFrequency(frequency time.Duration) bool
- func (cc *CacheCoherent) Statistics() CacheStatistics
- func (cc *CacheCoherent) Until(key, val any, until time.Time)
- type CachePriority
- type CacheStatistics
- type ConcurrentPriorityQueue
Constants ¶
View Source
const ( KindSliding cacheKind = iota KindNormal )
Variables ¶
View Source
var (
Default = memoryCache()
)
Functions ¶
This section is empty.
Types ¶
type CacheCoherent ¶
type CacheCoherent struct {
// contains filtered or unexported fields
}
CacheCoherent Wrapper for the memory cache entries collection.
func New ¶
func New() *CacheCoherent
func (*CacheCoherent) Delay ¶
func (cc *CacheCoherent) Delay(key, val any, ttl time.Duration)
Delay expires after a period of time. e.g. time.Hour, it will expire after one hour from now
func (*CacheCoherent) Forever ¶
func (cc *CacheCoherent) Forever(key, val any)
Forever never expiration
func (*CacheCoherent) Forget ¶
func (cc *CacheCoherent) Forget(key any)
Forget removes an item from the memory
func (*CacheCoherent) Have ¶
func (cc *CacheCoherent) Have(key any) bool
Have returns true if the memory has the item, and it's not expired.
func (*CacheCoherent) Inactive ¶
func (cc *CacheCoherent) Inactive(key, val any, inactive time.Duration)
Inactive expires after it is inactive for more than a period of time
func (*CacheCoherent) Read ¶
func (cc *CacheCoherent) Read(key any) (any, bool)
Read returns the value if the key exists in the cache
func (*CacheCoherent) Reset ¶
func (cc *CacheCoherent) Reset()
Reset removes all items from the memory
func (*CacheCoherent) SetScanFrequency ¶
func (cc *CacheCoherent) SetScanFrequency(frequency time.Duration) bool
SetScanFrequency sets a new frequency value
func (*CacheCoherent) Statistics ¶
func (cc *CacheCoherent) Statistics() CacheStatistics
type CachePriority ¶
type CachePriority int
const ( PriorityLow CachePriority = iota PriorityNormal PriorityHigh PriorityNeverRemove )
type CacheStatistics ¶
type CacheStatistics struct {
// contains filtered or unexported fields
}
type ConcurrentPriorityQueue ¶
type ConcurrentPriorityQueue struct {
// contains filtered or unexported fields
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.