Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// Len is the total cached data count.
Len int
// Cap is the maximum capacity of the cache.
Cap int
// CleanInterval is the time duration to make cache empty.
CleanInterval time.Duration
// ExpirationTimeoutInterval indicates the time to delete expired items.
ExpirationTimeoutInterval time.Duration
// contains filtered or unexported fields
}
Cache is the main cache type.
func New ¶
New creates a new cache and returns it with error type. Capacity of the cache needs to be more than zero.
func (*Cache) Contains ¶
Contains checks the given key and returns the information that it exists on cache or not. Calling this function doesn't change the access order of the cache.
func (*Cache) Get ¶
Get retrieves the data from list and returns it with bool information which indicates whether found. If there is no such data in cache, it returns nil and false.
Click to show internal directories.
Click to hide internal directories.