File size: 553 Bytes
f770e40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Package cache provides the canonical Cache interface for AmaniQuery.
package cache

import (
	"context"
	"time"
)

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
	GetOrSet(ctx context.Context, key string, fn func() ([]byte, error), ttl time.Duration) ([]byte, error)
	DeleteByPrefix(ctx context.Context, prefix string) error
	NormalizeKey(parts ...string) string
	Healthy() bool
	Close() error
}