redis

package module
v3.0.0-...-1524b23 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

README

Redis

Installation

go get -u github.com/gojuukaze/YTask/drives/redis/v3

Broker

package main

import (
    "github.com/gojuukaze/YTask/drives/redis/v3"
)

func main() {
	broker := redis.NewRedisBroker("127.0.0.1", "6379", "", 0, 3)
	// ...
}

Backend

package main

import (
    "github.com/gojuukaze/YTask/drives/redis/v3"
)

func main() {
	backend := redis.NewRedisBackend("127.0.0.1", "6379", "", 0, 10)
	// ...
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

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

func NewRedisBackend

func NewRedisBackend(host string, port string, password string, db int, poolSize int) Backend

NewRedisBackend

  • poolSize: Maximum number of idle connections in the pool. If poolSize<=0 use default value. default value is min(10, numWorkers) at SERVER default value is 10 at CLIENT

func (*Backend) Activate

func (r *Backend) Activate()

func (Backend) Clone

func (r Backend) Clone() backends.BackendInterface

func (*Backend) GetPoolSize

func (r *Backend) GetPoolSize() int

func (*Backend) GetResult

func (r *Backend) GetResult(key string) (message.Result, error)

func (*Backend) SetPoolSize

func (r *Backend) SetPoolSize(n int)

func (*Backend) SetResult

func (r *Backend) SetResult(result message.Result, exTime int) error

type Broker

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

func NewRedisBroker

func NewRedisBroker(host string, port string, password string, db int, poolSize int) Broker

NewRedisBroker

  • poolSize: Maximum number of idle connections in client pool. If clientPoolSize<=0, clientPoolSize=10

func (*Broker) Activate

func (r *Broker) Activate()

func (Broker) Clone

func (r Broker) Clone() brokers.BrokerInterface

func (*Broker) GetPoolSize

func (r *Broker) GetPoolSize() int

func (*Broker) LSend

func (r *Broker) LSend(queueName string, msg message.Message) error

func (*Broker) Next

func (r *Broker) Next(queueName string) (message.Message, error)

func (*Broker) Send

func (r *Broker) Send(queueName string, msg message.Message) error

func (*Broker) SetPoolSize

func (r *Broker) SetPoolSize(n int)

type Client

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

func NewRedisClient

func NewRedisClient(host string, port string, password string, db int, poolSize int) Client

func (*Client) BLPop

func (c *Client) BLPop(key string, timeout time.Duration) *redis.StringSliceCmd

func (*Client) Close

func (c *Client) Close()

func (*Client) Do

func (c *Client) Do(args ...interface{}) *redis.Cmd

func (*Client) Exists

func (c *Client) Exists(key string) (bool, error)

======================= high api =======================

func (*Client) Flush

func (c *Client) Flush() error

func (*Client) Get

func (c *Client) Get(key string) *redis.StringCmd

func (*Client) LPush

func (c *Client) LPush(key string, value interface{}) error

func (*Client) Ping

func (c *Client) Ping() error

func (*Client) RPush

func (c *Client) RPush(key string, value interface{}) error

func (*Client) Set

func (c *Client) Set(key string, value interface{}, exTime time.Duration) error

Jump to

Keyboard shortcuts

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