Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CacheSaveFailed = fmt.Errorf("cache failed to save")
Functions ¶
func NewCacheWrapper ¶ added in v1.1.0
func NewCacheWrapper(cache RequestCache) service.Wrapper
NewCacheWrapper
Enable caching throughout the app. Cache will only be applied where the requests implement at least CacheableRequest interface. This is a convenience function to create a wrapper.
func WithCache ¶
func WithCache(cache RequestCache) config.GkBootOption
WithCache
Use to enable caching throughout the app. Cache will only be applied where the requests implement at least CacheableRequest interface
Types ¶
type CacheableRequest ¶
type CacheableRequest interface {
CacheKey() string
}
CacheableRequest
Any object implementing CacheKey can represent a cache key for the purposes of a gkBoot cache
type RequestCache ¶
type RequestCache interface {
Get(ctx context.Context, key string) (interface{}, error)
Put(ctx context.Context, key string, value interface{}, ttl time.Duration) (interface{}, error)
}
RequestCache
Any object implementing Get and Put of this interface will qualify for being a RequestCache
Click to show internal directories.
Click to hide internal directories.