memory

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() interface {
	stash.Stasher
	Memory
}

New can be used to create a concrete instance of a memory cache/stash. If Configuration is provided, it will attempt to initialize the pointer (it will panic if this initialization fails)

Types

type Configuration

type Configuration struct {
	EvictionPolicy stash.EvictionPolicy `json:"eviction_policy"`
	TimeToLive     time.Duration        `json:"time_to_live"`
	MaxSize        int                  `json:"max_size"`
	Debug          bool                 `json:"debug"`
	DebugPrefix    string               `json:"debug_prefix"`
}

Configuration describes what can be configured for the memory stash

type Memory

type Memory interface {
	//Configure
	Configure(...interface{}) error

	//SetParameters
	SetParameters(...interface{})

	//Initialize can be used to setup internal pointers
	// and ready the stash for usage
	Initialize() error

	//Shutdown can be used to tear down internal pointers
	// and ready the stash for garbage collection (or reuse)
	Shutdown() error
}

Memory describes the concrete implementation of the memory stash that isn't described by the Stasher interface

Jump to

Keyboard shortcuts

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