toyredis

package module
v0.0.0-...-19cb0e2 Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KB          = 1 << 10
	MB          = 1 << 20
	GB          = 1 << 30
	Millisecond = 1
	Second      = 1000
	Minute      = 60000
)
View Source
const (
	ErrorReply  = '-'
	StatusReply = '+'
	IntReply    = ':'
	StringReply = '$'
	ArrayReply  = '*'
)

Variables

This section is empty.

Functions

func NewServer

func NewServer(port string, sizeLimit int) *server

Types

type Cache

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

func NewCache

func NewCache(sizeLimit int) *Cache

func (*Cache) Exists

func (c *Cache) Exists(key string) int

func (*Cache) Expire

func (c *Cache) Expire(key string, ttl int) int

ttl: milliseconds

func (*Cache) Flush

func (c *Cache) Flush()

func (*Cache) Get

func (c *Cache) Get(key string) (value []byte, err error)

func (*Cache) GetSize

func (c *Cache) GetSize() int

func (*Cache) GetSizeLimit

func (c *Cache) GetSizeLimit() int

func (*Cache) HDel

func (c *Cache) HDel(key string, kk []string) (num int, err error)

func (*Cache) HExists

func (c *Cache) HExists(key, k string) (num int, err error)

func (*Cache) HGet

func (c *Cache) HGet(key string, vk string) (value []byte, err error)

func (*Cache) HGetAll

func (c *Cache) HGetAll(key string) (value [][]byte, err error)

func (*Cache) HSet

func (c *Cache) HSet(key string, vk string, vv []byte) (err error)

func (*Cache) Remove

func (c *Cache) Remove(key []string) (num int)

func (*Cache) Set

func (c *Cache) Set(key string, value []byte) (err error)

func (*Cache) SetSizeLimit

func (c *Cache) SetSizeLimit(sizeLimit int)

func (*Cache) Stop

func (c *Cache) Stop()

type Conn

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

func NewConn

func NewConn(c net.Conn) *Conn

type Reader

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

func NewReader

func NewReader(rd io.Reader) *Reader

func (*Reader) ReadRequest

func (r *Reader) ReadRequest() ([]string, error)

type Writer

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

func NewWriter

func NewWriter(w writer) *Writer

func (*Writer) Error

func (w *Writer) Error(s string) error

func (*Writer) Int

func (w *Writer) Int(i int) error

func (*Writer) NullStringArray

func (w *Writer) NullStringArray() error

func (*Writer) Status

func (w *Writer) Status(s string) error

func (*Writer) String

func (w *Writer) String(b []byte) error

func (*Writer) StringArray

func (w *Writer) StringArray(bs [][]byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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