cache

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Helper

type Helper[T any] struct {
	cache.CacheInterface[T]
}

func (*Helper[T]) GetOrSet

func (h *Helper[T]) GetOrSet(ctx context.Context, key any, fn func(ctx context.Context) (T, error), opts ...Option) (v T, err error, set bool)

type Option

type Option func(*option)

func WithGroup

func WithGroup(g ...*singleflight.Group) Option

func WithStoreOption

func WithStoreOption(opt ...store.Option) Option

type ProtoCache

type ProtoCache[T proto.Message] struct {
	// contains filtered or unexported fields
}

func NewProtoCache

func NewProtoCache[T proto.Message](creator func() T, proxy cache.CacheInterface[string]) *ProtoCache[T]

func (*ProtoCache[T]) Clear

func (c *ProtoCache[T]) Clear(ctx context.Context) error

func (*ProtoCache[T]) Delete

func (c *ProtoCache[T]) Delete(ctx context.Context, key any) error

func (*ProtoCache[T]) Get

func (c *ProtoCache[T]) Get(ctx context.Context, key any) (T, error)

func (*ProtoCache[T]) GetType

func (c *ProtoCache[T]) GetType() string

func (*ProtoCache[T]) Invalidate

func (c *ProtoCache[T]) Invalidate(ctx context.Context, options ...store.InvalidateOption) error

func (*ProtoCache[T]) Set

func (c *ProtoCache[T]) Set(ctx context.Context, key any, object T, options ...store.Option) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL