storagecache

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2017 License: MIT Imports: 3 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(s Storage, opts ...CacheOption) datastore.Middleware

Types

type CacheItem

type CacheItem struct {
	Key          datastore.Key
	PropertyList datastore.PropertyList
}

type CacheOption

type CacheOption interface {
	Apply(*cacheHandler)
}

func WithExcludeKinds

func WithExcludeKinds(kinds ...string) CacheOption

func WithIncludeKinds

func WithIncludeKinds(kinds ...string) CacheOption

func WithKeyFilter

func WithKeyFilter(f func(key datastore.Key) bool) CacheOption

type Logger

type Logger interface {
	Printf(ctx context.Context, format string, args ...interface{})
}

type Storage

type Storage interface {
	SetMulti(ctx context.Context, is []*CacheItem) error
	// GetMulti returns slice of CacheItem of the same length as Keys of the argument.
	// If not in the dsmiddleware, the value of the corresponding element is nil.
	GetMulti(ctx context.Context, keys []datastore.Key) ([]*CacheItem, error)
	DeleteMulti(ctx context.Context, keys []datastore.Key) error
}

type TxOpLog

type TxOpLog struct {
	Ops          TxOps
	Key          datastore.Key
	PendingKey   datastore.PendingKey
	PropertyList datastore.PropertyList
}

type TxOps

type TxOps int
const (
	TxPutOp TxOps = iota
	TxGetOp
	TxDeleteOp
)

Jump to

Keyboard shortcuts

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