package cache import ( "context" "time" ) type ( LoadFunc func(ctx context.Context) ([]byte, error) ) type Cache interface { Set(ctx context.Context, key string, buf []byte) SetEx(ctx context.Context, key string, buf []byte, expire time.Duration) Get(ctx context.Context, key string) (buf []byte, ok bool) Try(ctx context.Context, key string, cb LoadFunc) (buf []byte, err error) Del(ctx context.Context, key string) }