cache

package
v0.0.0-...-ebf29b9 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	// GetOrSet will fetch the value at 'key' as []byte and encode it into into.  If key does not exist, it will call the
	// data function for []byte, store that into key, and decode it into into
	GetOrSet(ctx context.Context, key []byte, ttl time.Duration, into interface{}, data func(ctx context.Context) (interface{}, error)) error
	// Delete the cached value at key
	Delete(ctx context.Context, key []byte) error
}

type ClearableCache

type ClearableCache interface {
	Clear(ctx context.Context) error
	Cache
}

type InMemoryCache

type InMemoryCache struct {
	// contains filtered or unexported fields
}

func (*InMemoryCache) Clear

func (i *InMemoryCache) Clear(_ context.Context) error

func (*InMemoryCache) Delete

func (i *InMemoryCache) Delete(_ context.Context, key []byte) error

func (*InMemoryCache) GetOrSet

func (i *InMemoryCache) GetOrSet(ctx context.Context, key []byte, ttl time.Duration, into interface{}, data func(ctx context.Context) (interface{}, error)) error

Jump to

Keyboard shortcuts

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