storage

package
v0.0.0-...-6d7d60d Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryStorage

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

MemoryStorage represents a "in memory" storage engine.

func NewMemoryStorage

func NewMemoryStorage(addr, auth string) *MemoryStorage

NewRedisStorage returns a new "in memory" storage client.

func (*MemoryStorage) HExists

func (m *MemoryStorage) HExists(key, field string) (bool, error)

HExists implements Storage.HExists()

func (*MemoryStorage) HGet

func (m *MemoryStorage) HGet(key, field string) (string, error)

HGet implements Storage.HGet()

func (*MemoryStorage) HSet

func (m *MemoryStorage) HSet(key, field, value string) (bool, error)

HSet implements Storage.HSet()

type RedisStorage

type RedisStorage struct {
	Client *redis.Client
}

RedisStorage represents the storage engine based on the Redis server.

func NewRedisStorage

func NewRedisStorage(addr, auth string) (*RedisStorage, error)

NewRedisStorage returns a new redis storage client.

func (*RedisStorage) HExists

func (r *RedisStorage) HExists(key, field string) (bool, error)

HExists is a thin wrapper around redis.HExists of `github.com/go-redis/redis`.

func (*RedisStorage) HGet

func (r *RedisStorage) HGet(key, field string) (string, error)

HGet is a thin wrapper around redis.HGet of `github.com/go-redis/redis`.

func (*RedisStorage) HSet

func (r *RedisStorage) HSet(key, field, value string) (bool, error)

HSet is a thin wrapper around redis.HSet of `github.com/go-redis/redis`.

type Storage

type Storage interface {
	HGet(key, field string) (string, error)
	HSet(key, field, value string) (bool, error)
	HExists(key, field string) (bool, error)
}

Storage represents a new storage type.

func NewStorage

func NewStorage(addr, auth, debug string) Storage

NewStorage returns a new storage.

Jump to

Keyboard shortcuts

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