memory

package
v0.0.0-...-4af24e4 Latest Latest
Warning

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

Go to latest
Published: May 25, 2020 License: MIT Imports: 3 Imported by: 1

Documentation

Overview

Package memory provides a lightweight in memory store for onecache Do take a look at other stores

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InMemoryStore

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

Represents an in-memory store

func New

func New(opts ...Option) *InMemoryStore

New returns a configured in memory store

func NewInMemoryStore

func NewInMemoryStore() *InMemoryStore

NewInMemoryStore returns a new instance of the Inmemory store Deprecated... Use New() instead

func (*InMemoryStore) Delete

func (i *InMemoryStore) Delete(key string) error

func (*InMemoryStore) Flush

func (i *InMemoryStore) Flush() error

func (*InMemoryStore) GC

func (i *InMemoryStore) GC()

func (*InMemoryStore) Get

func (i *InMemoryStore) Get(key string) ([]byte, error)

func (*InMemoryStore) Has

func (i *InMemoryStore) Has(key string) bool

func (*InMemoryStore) Set

func (i *InMemoryStore) Set(key string, data []byte, expires time.Duration) error

type Option

type Option func(i *InMemoryStore)

Option defines options for creating a memory store

func BufferSize

func BufferSize(n int) Option

BufferSize configures the store to allow a maximum of n

func KeyFunc

func KeyFunc(fn onecache.KeyFunc) Option

KeyFunc allows for dynamic generation of cache keys

Jump to

Keyboard shortcuts

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