Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LoadingCache ¶
type LoadingCache interface {
Get(key string, fn func() ([]byte, error)) (data []byte, err error)
Flush(scopes ...string)
}
LoadingCache defines interface for caching
func NewMemoryCache ¶
func NewMemoryCache(options ...Option) (LoadingCache, error)
NewMemoryCache makes memoryCache implementation
type Option ¶
type Option func(lc *memoryCache) error
Option func type
func MaxCacheSize ¶
MaxCacheSize functional option defines the total size of cached data. By default it is 0, which means unlimited.
func MaxKeys ¶
MaxKeys functional option defines how many keys to keep. By default it is 0, which means unlimited.
func MaxValSize ¶
MaxValSize functional option defines the largest value's size allowed to be cached By default it is 0, which means unlimited.
func PostFlushFn ¶
func PostFlushFn(postFlushFn func()) Option
PostFlushFn functional option defines how callback function called after each Flush.
Click to show internal directories.
Click to hide internal directories.