Documentation
¶
Index ¶
- func Fetch[T any](cache Cacher, key string, expiration time.Duration, fn func() (T, error)) (T, error)
- func FetchArg[T any, A any](cache Cacher, key string, expiration time.Duration, fn func(a A) (T, error), ...) (T, error)
- func Key(args ...interface{}) string
- type Cacher
- type MemoryCache
- type RedisCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cacher ¶
type MemoryCache ¶
type MemoryCache struct {
// contains filtered or unexported fields
}
func NewMemoryCache ¶
func NewMemoryCache(size int) *MemoryCache
func (*MemoryCache) Delete ¶
func (m *MemoryCache) Delete(keys ...string) error
func (*MemoryCache) Get ¶
func (m *MemoryCache) Get(key string, value interface{}) error
type RedisCache ¶
type RedisCache struct {
// contains filtered or unexported fields
}
func NewRedisCache ¶
func NewRedisCache(ctx context.Context, client *redis.Client) *RedisCache
func (*RedisCache) Delete ¶
func (r *RedisCache) Delete(keys ...string) error
func (*RedisCache) Get ¶
func (r *RedisCache) Get(key string, value interface{}) error
Click to show internal directories.
Click to hide internal directories.