16 lines
313 B
Go
16 lines
313 B
Go
|
|
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
|
||
|
|
}
|