Help us shape the future of Go! Take the 2026 Go Developer Survey

readygo

package module
v0.0.0-...-d135886 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2016 License: Apache-2.0 Imports: 5 Imported by: 0

README

readygo

a redis client for golang

Document

Getting Started

    config := &redis.Config{
        Password:    "123456", // passworf of redis, set "" as no auth
        Database:    10,
        PoolMaxIdle: 10, // capacity of connection pool
    }
    redis, _ = redis.Dial(config)

    // PING when take connection from the pool
    redis.PingOnPool()

    message, _ := redis.Execute("SET", "abc", "demo")

    message.String()

more introduce about the message : redis-protocol

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = &Config{
	Network:     "tcp",
	Address:     ":6379",
	Password:    "",
	Database:    0,
	Timeout:     6 * time.Second,
	PoolMaxIdle: 0,
	PoolChecker: func(item interface{}) error {
		return nil
	},
}

Functions

func NewConnection

func NewConnection(netConn net.Conn) *connection

Types

type Config

type Config struct {
	Network     string
	Address     string
	Password    string
	Database    int
	Timeout     time.Duration
	PoolMaxIdle int // 连接池容量
	PoolChecker func(item interface{}) error
}

type Redis

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

func Dial

func Dial(config *Config) (*Redis, error)

func (*Redis) Execute

func (redis *Redis) Execute(args ...interface{}) (*protocol.Message, error)

func (*Redis) PingOnPool

func (redis *Redis) PingOnPool()

Jump to

Keyboard shortcuts

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