memoryfood

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: Apache-2.0 Imports: 10 Imported by: 1

README

inmemory datastore implementation

Im-memory implementation of datastore interface

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCanceled = errors.New("operation was canceled")
)
View Source
var InMemoryStoreClass = reflect.TypeOf((*implInMemoryStore)(nil))

Functions

func FromCache

func FromCache(name string, c *cache.Cache) *implInMemoryStore

func New

func New(name string, options ...Option) *implInMemoryStore

func NewDefault

func NewDefault(name string) *implInMemoryStore

func ObjectType

func ObjectType() reflect.Type

func OpenDatabase

func OpenDatabase(options ...Option) *cache.Cache

Types

type Config

type Config struct {
	DefaultExpiration time.Duration
	CleanupInterval   time.Duration
}

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option configures memory storage using the functional options paradigm popularized by Rob Pike and Dave Cheney. If you're unfamiliar with this style, see https://commandcenter.blogspot.com/2014/01/self-referential-functions-and-design.html and https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis.

func WithCleanupInterval

func WithCleanupInterval(value time.Duration) Option

func WithDefaultExpiration

func WithDefaultExpiration(value time.Duration) Option

func WithNope

func WithNope() Option

option that do nothing

Jump to

Keyboard shortcuts

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