123456789101112131415161718 |
- package cache
- import (
- "context"
- "time"
- )
- type (
- LoadFunc func(ctx context.Context) (any, error)
- )
- type Cache interface {
- Set(ctx context.Context, key string, value any)
- SetEx(ctx context.Context, key string, value any, expire time.Duration)
- Get(ctx context.Context, key string) (value any, ok bool)
- Try(ctx context.Context, key string, cb LoadFunc) (value any, err error)
- Del(ctx context.Context, key string)
- }
|