data

package
v0.0.0-...-4338856 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2016 License: BSD-3-Clause Imports: 2 Imported by: 0

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)

func (*MemoryStore) Get

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

Get retrieve 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{})

Dummy 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