memstore

package
v0.0.0-...-405b8c4 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2015 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyValueStore

type KeyValueStore interface {
	Get(key string) (interface{}, bool)
	Set(key string, value interface{})
}

type MemoryStore

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

func NewMemoryStore

func NewMemoryStore() *MemoryStore

func (*MemoryStore) Get

func (ms *MemoryStore) Get(key string) (interface{}, bool)

func (*MemoryStore) GetValue

func (ms *MemoryStore) GetValue(dst interface{}, key string) (err error)

GetValue takes dst which must pointer to a string, int, float64, bool, or struct and key as a string for parameters. If the MemoryStore has an entry for the key, and the dst type matches the stored type, then the dst's value will be given the value found in the MemoryStore

func (*MemoryStore) Keys

func (ms *MemoryStore) Keys() []string

func (*MemoryStore) LoadSnapshot

func (ms *MemoryStore) LoadSnapshot(r io.Reader) error

func (*MemoryStore) SaveSnapshot

func (ms *MemoryStore) SaveSnapshot(w io.Writer) error

func (*MemoryStore) Set

func (ms *MemoryStore) Set(key string, value interface{})

type PersistentKeyValueStore

type PersistentKeyValueStore interface {
	KeyValueStore
	SaveSnapshot() error
	LoadSnapshot() error
}

type Snapshot

type Snapshot struct {
	Version uint64                 `json:"ver"`
	Values  map[string]interface{} `json:"val"`
}

Jump to

Keyboard shortcuts

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