2026-04-02 00:31:28 +08:00
|
|
|
package cache
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"errors"
|
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var ErrNotFound = errors.New("cache: key not found")
|
|
|
|
|
|
|
|
|
|
type Cache interface {
|
|
|
|
|
Get(ctx context.Context, key string) ([]byte, error)
|
|
|
|
|
Set(ctx context.Context, key string, value []byte, ttl time.Duration) error
|
|
|
|
|
Delete(ctx context.Context, key string) error
|
2026-04-15 16:11:05 +08:00
|
|
|
DeletePrefix(ctx context.Context, prefix string) error
|
2026-04-02 00:31:28 +08:00
|
|
|
}
|