store

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	Set(k string, v string, ttl time.Duration) error
	Get(k string) (string, error)
	Delete(k string) error
}

StoreAPI abstracts the storage backend.

func NewStore

func NewStore(driver, parameters string) (API, error)

type DummyStore

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

func (*DummyStore) Delete

func (store *DummyStore) Delete(k string) error

func (*DummyStore) Get

func (store *DummyStore) Get(k string) (string, error)

func (*DummyStore) Set

func (store *DummyStore) Set(k string, v string, ttl time.Duration) error

type FileStore

type FileStore struct {
	*Store
	// contains filtered or unexported fields
}

DataStore represents the conntection to the Google Cloud Datastore.

func NewFileStore

func NewFileStore(path string) (*FileStore, error)

func (*FileStore) Delete

func (fs *FileStore) Delete(k string) error

func (*FileStore) Get

func (fs *FileStore) Get(k string) (string, error)

func (*FileStore) Set

func (fs *FileStore) Set(k string, v string, ttl time.Duration) error

type Internal

type Internal struct {
	*Store
	// contains filtered or unexported fields
}

Internal represents the internal memstore

func NewInternalStore

func NewInternalStore() (*Internal, error)

NewInternalStore returns a new initialized store with a 60s TTL

func (*Internal) Delete

func (store *Internal) Delete(k string) error

Delete removes an entry in the store.

func (*Internal) Get

func (store *Internal) Get(k string) (string, error)

Get looks up an entry in the store.

func (*Internal) NumEntries

func (store *Internal) NumEntries() int

NumEntries returns the number of entries currently in the store

func (*Internal) Set

func (store *Internal) Set(k string, v string, ttl time.Duration) error

Set adds (or updates) an entry in the store. If 'ttl' is 0, the entry never expires

type Redis

type Redis struct {
	*Store
	// contains filtered or unexported fields
}

Redis represents a Redis-based backing store.

func NewRedisStore

func NewRedisStore(address string) (*Redis, error)

func (*Redis) Delete

func (store *Redis) Delete(k string) error

func (*Redis) Get

func (store *Redis) Get(k string) (string, error)

func (*Redis) Set

func (store *Redis) Set(k string, v string, ttl time.Duration) error

func (*Redis) WithPrefix

func (store *Redis) WithPrefix(prefix string) *Redis

type Store

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

Store represents the storage backend. Currently, only "internal" and "redis" are supported.

Jump to

Keyboard shortcuts

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