Documentation
¶
Index ¶
- func WithDefaultDuration[K comparable, V any](duration time.Duration) trcache.RootOption
- func WithKeyCodec[K comparable, V any](keyCodec trcache.KeyCodec[K]) trcache.RootOption
- func WithValidator[K comparable, V any](validator trcache.Validator[V]) trcache.RootOption
- func WithValueCodec[K comparable, V any](valueCodec trcache.Codec[V]) trcache.RootOption
- type Cache
- func (c *Cache[K, V]) Delete(ctx context.Context, key K, options ...trcache.DeleteOption) error
- func (c *Cache[K, V]) Get(ctx context.Context, key K, options ...trcache.GetOption) (V, error)
- func (c *Cache[K, V]) Handle() *freecache.Cache
- func (c *Cache[K, V]) Name() string
- func (c *Cache[K, V]) Set(ctx context.Context, key K, value V, options ...trcache.SetOption) error
- type RefreshCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithDefaultDuration ¶
func WithDefaultDuration[K comparable, V any](duration time.Duration) trcache.RootOption
func WithKeyCodec ¶
func WithKeyCodec[K comparable, V any](keyCodec trcache.KeyCodec[K]) trcache.RootOption
func WithValidator ¶
func WithValidator[K comparable, V any](validator trcache.Validator[V]) trcache.RootOption
func WithValueCodec ¶
func WithValueCodec[K comparable, V any](valueCodec trcache.Codec[V]) trcache.RootOption
Types ¶
type Cache ¶
type Cache[K comparable, V any] struct { // contains filtered or unexported fields }
func New ¶
func New[K comparable, V any](cache *freecache.Cache, options ...trcache.RootOption) (*Cache[K, V], error)
type RefreshCache ¶
type RefreshCache[K comparable, V any] struct { *Cache[K, V] // contains filtered or unexported fields }
func NewRefresh ¶
func NewRefresh[K comparable, V any](cache *freecache.Cache, options ...trcache.RootOption) (*RefreshCache[K, V], error)
func (*RefreshCache[K, V]) GetOrRefresh ¶
func (c *RefreshCache[K, V]) GetOrRefresh(ctx context.Context, key K, options ...trcache.RefreshOption) (V, error)
Click to show internal directories.
Click to hide internal directories.