redis

package
v0.0.0-...-b1b21d8 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: LGPL-3.0 Imports: 9 Imported by: 0

README

功能概述

  • 集合,字典操作
  • 随机代理

Documentation

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
}

func NewClient

func NewClient(option ClientOption) (*Client, error)

func (*Client) Close

func (r *Client) Close() error

关闭客户端

func (*Client) GetOrderProxy

func (r *Client) GetOrderProxy(key string) (string, error)

随机获取代理(有序)

func (*Client) GetOrderProxys

func (r *Client) GetOrderProxys(key string) ([]string, error)

获取所有代理,排序后的

func (*Client) GetProxy

func (r *Client) GetProxy(key string) (string, error)

获取最新代理

func (*Client) GetProxyData

func (r *Client) GetProxyData(key string) (Proxy, error)

获取最新代理

func (*Client) GetProxyDatas

func (r *Client) GetProxyDatas(key string) ([]Proxy, error)

获取所有代理

func (*Client) GetProxys

func (r *Client) GetProxys(key string) ([]string, error)

获取所有代理

func (*Client) HAll

func (r *Client) HAll(name string) (map[string]string, error)

获取字典

func (*Client) HDel

func (r *Client) HDel(name string, key string) (int64, error)

删除字典的值

func (*Client) HGet

func (r *Client) HGet(name string, key string) (string, error)

获取字典中的key值

func (*Client) HKeys

func (r *Client) HKeys(name string) ([]string, error)

获取字典所有key

func (*Client) HLen

func (r *Client) HLen(name string) (int64, error)

获取字典长度

func (*Client) HSet

func (r *Client) HSet(name string, key string, val string) (bool, error)

设置字典的值

func (*Client) HVals

func (r *Client) HVals(name string) ([]string, error)

获取字典所有值

func (*Client) SAdd

func (r *Client) SAdd(name string, vals ...any) (int64, error)

集合增加元素

func (*Client) SExists

func (r *Client) SExists(name string, val any) (bool, error)

判断元素是否存在集合

func (*Client) SLen

func (r *Client) SLen(name string) (int64, error)

集合长度

func (*Client) SPop

func (r *Client) SPop(name string) (string, error)

删除一个元素返回

func (*Client) SRem

func (r *Client) SRem(name string, vals ...any) (int64, error)

删除元素

func (*Client) SVals

func (r *Client) SVals(name string) ([]string, error)

集合所有的值

type ClientOption

type ClientOption struct {
	Host string //host
	Port int    //端口号
	Pwd  string //密码
	Db   int    //数据库
}

type Proxy

type Proxy struct {
	Ip    string
	Port  int64
	Ttl   int64
	Usr   string
	Pwd   string
	Proxy string
}

Jump to

Keyboard shortcuts

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