Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶ added in v0.1.8
type Cache interface { Get(key interface{}) (interface{}, bool) SetWithTTL(key, value interface{}, cost int64, ttl time.Duration) bool Del(key interface{}) Clear() }
Cache represents caching functionality. Concrete implementation is expected to be thread-safe.
type Provider ¶
type Provider struct {
Cache Cache
}
Provider provides the underlying StorageProvider with caching support.
func (*Provider) Wrap ¶ added in v0.1.8
func (p *Provider) Wrap(storageProvider StorageProvider, opts ...WrapOption) storage.Provider
Wrap adds caching support to the underlying StorageProvider.
type StorageProvider ¶ added in v0.1.8
StorageProvider is an alias for storage.Provider.
type WrapOption ¶ added in v0.1.8
type WrapOption func(p *wrapOptions)
WrapOption configures wrapped provider.
func WithCacheTTL ¶ added in v0.1.8
func WithCacheTTL(ttl time.Duration) WrapOption
WithCacheTTL sets the TTL (time to live) for cache items.
Click to show internal directories.
Click to hide internal directories.