keyvalue

package
v0.0.0-...-dc37515 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2021 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Prefixed

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

Prefixed is a key-value store that prefixes each key.

func NewPrefixed

func NewPrefixed(store Store, prefix string) *Prefixed

func (*Prefixed) Delete

func (s *Prefixed) Delete(key string) error

func (*Prefixed) Get

func (s *Prefixed) Get(key string) (string, error)

func (*Prefixed) Set

func (s *Prefixed) Set(key, value string) error

func (*Prefixed) SetExpiring

func (s *Prefixed) SetExpiring(key, value string, expires time.Duration) error

type Redis

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

func NewRedis

func NewRedis(client *redis.Client) *Redis

func (*Redis) Delete

func (s *Redis) Delete(key string) error

func (*Redis) Get

func (s *Redis) Get(key string) (string, error)

func (*Redis) Set

func (s *Redis) Set(key, value string) error

func (*Redis) SetExpiring

func (s *Redis) SetExpiring(key, value string, expires time.Duration) error

type Store

type Store interface {
	Get(key string) (string, error)
	Set(key, value string) error
	SetExpiring(key, value string, expires time.Duration) error
	Delete(key string) error
}

Store represents a key-value storage.

Jump to

Keyboard shortcuts

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