Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FlusherRequest ¶
type FlusherRequest struct {
// contains filtered or unexported fields
}
FlusherRequest used as input for cache.Flush
func Flusher ¶
func Flusher(siteID string) FlusherRequest
Flusher makes new FlusherRequest with empty scopes
func (FlusherRequest) Scopes ¶
func (f FlusherRequest) Scopes(scopes ...string) FlusherRequest
Scopes adds scopes to FlusherRequest
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
Key for cache
func ParseKey ¶
ParseKey gets compound key created by Key func and split it to the actual key and scopes
type LoadingCache ¶
type LoadingCache interface {
Get(key Key, fn func() ([]byte, error)) (data []byte, err error)
Flush(req FlusherRequest)
}
LoadingCache defines interface for caching
func NewMemoryCache ¶
func NewMemoryCache(options ...Option) (LoadingCache, error)
NewMemoryCache makes memoryCache implementation
type Option ¶
type Option func(lc cacheWithOpts) 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.