data

package
v0.0.0-...-e540a08 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2021 License: BSD-3-Clause Imports: 2 Imported by: 2

Documentation

Overview

Package data provides an interface for common data store operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryStore

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

MemoryStore is an implementation for memory based data store.

func NewMemoryStore

func NewMemoryStore() *MemoryStore

NewMemoryStore creates the new store.

func (*MemoryStore) DelPrefix

func (m *MemoryStore) DelPrefix(prefix string)

DelPrefix deletes records from the MemoryStore's heap when the keys match the given prefix.

func (*MemoryStore) Get

func (m *MemoryStore) Get(key string) (value interface{}, ok bool)

Get retrieves the value pointed by the key.

func (*MemoryStore) IncrBy

func (m *MemoryStore) IncrBy(key string, delta int64) (newVal int64)

IncrBy increments the value pointed by key with the delta, and return the new value.

func (*MemoryStore) Publish

func (m *MemoryStore) Publish(k string, d interface{})

Publish is a dummy no-op method.

func (*MemoryStore) Set

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

Set stores the key value pair.

type Store

type Store interface {
	Get(key string) (value interface{}, ok bool)
	Set(key string, value interface{}) bool
	IncrBy(key string, delta int64) (newVal int64)
	Publish(key string, value interface{})
}

Store is an interface that capture all methods supported for a data store.

Jump to

Keyboard shortcuts

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