mole

package
v1.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCacheMiss is Cacheに存在しない時に返す
	ErrCacheMiss = errors.New("mole: cache miss")
)

Functions

This section is empty.

Types

type Item

type Item struct {
	// Key is 主となるKey
	Key string

	// SurrogateKeys is 代理で利用できるKeyの一覧
	// SurrogateKeyは全体でUniqueである必要はない
	SurrogateKeys []string

	// Value is 値
	Value []byte

	// ExpiredAt is 有効期限
	ExpiredAt time.Time
}

type Service

type Service interface {
	Get(ctx context.Context, key string) (*Item, error)
	GetBySurrogateKey(ctx context.Context, surrogateKey string) ([]*Item, error)
	GetMulti(ctx context.Context, keys []string) (map[string]*Item, error)
	Set(ctx context.Context, item *Item) error
	SetMulti(ctx context.Context, items []*Item) error
	Delete(ctx context.Context, key string) error
	DeleteBySurrogateKey(ctx context.Context, surrogateKey string) error
	DeleteMulti(ctx context.Context, keys []string) error
	DeleteMultiBySurrogateKey(ctx context.Context, surrogateKeys []string) error
	FlushAll(ctx context.Context) error
}

func NewService

func NewService() (Service, error)

type SpannerService

type SpannerService struct {
}

func (*SpannerService) Delete

func (s *SpannerService) Delete(ctx context.Context, key string) error

func (*SpannerService) DeleteBySurrogateKey

func (s *SpannerService) DeleteBySurrogateKey(ctx context.Context, surrogateKey string) error

func (*SpannerService) DeleteMulti

func (s *SpannerService) DeleteMulti(ctx context.Context, keys []string) error

func (*SpannerService) DeleteMultiBySurrogateKey

func (s *SpannerService) DeleteMultiBySurrogateKey(ctx context.Context, surrogateKeys []string) error

func (*SpannerService) FlushAll

func (s *SpannerService) FlushAll(ctx context.Context) error

func (*SpannerService) Get

func (s *SpannerService) Get(ctx context.Context, key string) (*Item, error)

func (*SpannerService) GetBySurrogateKey

func (s *SpannerService) GetBySurrogateKey(ctx context.Context, surrogateKey string) ([]*Item, error)

func (*SpannerService) GetMulti

func (s *SpannerService) GetMulti(ctx context.Context, keys []string) (map[string]*Item, error)

func (*SpannerService) Set

func (s *SpannerService) Set(ctx context.Context, item *Item) error

func (*SpannerService) SetMulti

func (s *SpannerService) SetMulti(ctx context.Context, items []*Item) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL