Documentation ¶
Index ¶
- Variables
- func IsNotFound(err error) bool
- func Load[T any, D Decoder](ctx context.Context, c ByteCache, d D, key string) (*T, error)
- func LoadEx[T any, D Decoder, E Encoder](ctx context.Context, c ByteCache, d D, e E, sf *singleflight.Group, key string, ...) (*T, error)
- func LoadJson[T any](ctx context.Context, c ByteCache, key string) (*T, error)
- func LoadJsonEx[T any](ctx context.Context, c ByteCache, sf *singleflight.Group, key string, ...) (*T, error)
- func Save[T any, E Encoder](ctx context.Context, c ByteCache, e E, key string, value *T, ...) error
- func SaveJson[T any](ctx context.Context, c ByteCache, key string, value *T, ...) error
- type ByteCache
- type Cache
- type Decoder
- type DecoderFunc
- type Encoder
- type EncoderFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var (
NotFound = fmt.Errorf("not found")
)
Functions ¶
func IsNotFound ¶
func LoadJsonEx ¶
Types ¶
type Cache ¶
type Cache[S any] interface { Set(ctx context.Context, key string, val S, expiration time.Duration) error Get(ctx context.Context, key string) (*S, error) Del(ctx context.Context, key string) error MultiSet(ctx context.Context, valMap map[string]S, expiration time.Duration) error MultiGet(ctx context.Context, keys []string) (map[string]S, error) MultiDel(ctx context.Context, keys []string) error DelAll(ctx context.Context) error io.Closer }
type DecoderFunc ¶
Click to show internal directories.
Click to hide internal directories.