redis

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package redis provides Redis client implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a struct that provides client related methods.

func (*Client) DBsize

func (this *Client) DBsize() (int, error)

DBsize is key count in current database.

ex) keyCount, err := client.DBsize()

func (*Client) Del

func (this *Client) Del(key any) error

Del is delete data.

ex) err := client.Del(key)

func (*Client) Exists

func (this *Client) Exists(keys ...any) (bool, error)

Exists is returns whether the keys exists.

ex 1) existsKey, err := client.Exists("key") ex 2) existsKey, err := client.Exists("key", 1, 2, "3")

func (*Client) Finalize

func (this *Client) Finalize() error

Finalize is finalize.

ex) err := client.Finalize()

func (*Client) FlushAll

func (this *Client) FlushAll() error

FlushAll is delete all data in all database.

ex) err := client.FlushAll()

func (*Client) FlushDB

func (this *Client) FlushDB() error

FlushDB is delete all data in current database.

ex) err := client.FlushDB()

func (*Client) Get

func (this *Client) Get(key any) (string, error)

Get is get data.

ex) data, err := client.Get(key)

func (*Client) Info

func (this *Client) Info(info string) (string, error)

Info is get redis information.

kind : All, Server, Clients, Memory, Persistence, Stats, Replication, CPU, Cluster, Keyspace

ex) result, err := client.Info("ALL")

func (*Client) Initialize

func (this *Client) Initialize(address, password string, maxConnection int, timeout time.Duration) error

Initialize is initialize.

ex) err := client.Initialize("127.0.0.1:6379", "", 10, 60)

func (*Client) MGet

func (this *Client) MGet(keys ...any) ([]string, error)

MGet is multiple get data.

ex) data, err := client.MGet(key1, key2)

func (*Client) MSet

func (this *Client) MSet(args ...any) error

MSet is multiple set data.

ex) err := client.MSet(key1, value1, key2, value2)

func (*Client) Ping

func (this *Client) Ping() error

Ping is send ping.

ex) client.Ping()

func (*Client) RandomKey

func (this *Client) RandomKey() (string, error)

RandomKey is returns one key at random.

ex) key, err := client.RandomKey()

func (*Client) Rename

func (this *Client) Rename(currentKey, newKey any) error

Rename is rename key.

ex) err := client.Rename("key", "key_rename")

func (*Client) Select

func (this *Client) Select(index int) error

Select is select database.

ex) err := client.Select(0)

func (*Client) Set

func (this *Client) Set(key, value any) error

Set is set data.

ex) err := client.Set(key, value)

func (*Client) Setex

func (this *Client) Setex(key any, second int, value any) error

Set is set data, but it is delete after specified time.

ex) err := client.Setex("key", 2, "value")

func (*Client) Ttl

func (this *Client) Ttl(key any) (int, error)

Ttl is returns valid time.

If there is not exist key, -2 is returned.

If the expire time is not set, -1 is returned.

ex) ttl, err := client.Ttl("key")

Jump to

Keyboard shortcuts

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