1package cache
2
3import (
4 "context"
5)
6
7// ItemOption is an option for setting cache items.
8type ItemOption func(Item)
9
10// Item is an interface that represents a cache item.
11type Item interface {
12 item()
13}
14
15// Option is an option for creating new cache.
16type Option func(Cache)
17
18// Cache is a caching interface.
19type Cache interface {
20 Get(ctx context.Context, key string) (value any, ok bool)
21 Set(ctx context.Context, key string, val any, opts ...ItemOption)
22 Keys(ctx context.Context) []string
23 Len(ctx context.Context) int64
24 Contains(ctx context.Context, key string) bool
25 Delete(ctx context.Context, key string)
26}