redis

package
v1.3.12 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProxySetKey     = "proxy:list"      // 使用普通set存储代理
	PreferredSetKey = "proxy:preferred" // 存储优选代理的有序集合
)

Variables

This section is empty.

Functions

func AddPreferredProxy added in v1.3.8

func AddPreferredProxy(proxy string, responseTime float64) error

AddPreferredProxy 添加到优选代理列表,使用响应时间作为分数

func ClearPreferredProxies added in v1.3.8

func ClearPreferredProxies() error

ClearPreferredProxies 清空优选代理列表

func GetAllProxies added in v1.3.8

func GetAllProxies() ([]string, error)

GetAllProxies 获取所有代理

func GetClient

func GetClient() *redis.Client

func GetPreferredProxies added in v1.3.8

func GetPreferredProxies() ([]string, error)

GetPreferredProxies 获取所有优选代理,按响应时间排序

func GetPreferredProxy added in v1.3.8

func GetPreferredProxy() (string, error)

GetPreferredProxy 获取响应时间最快的优选代理

func GetPreferredProxyCount added in v1.3.8

func GetPreferredProxyCount() (int64, error)

GetPreferredProxyCount 获取优选代理数量

func GetProxyCount added in v1.3.5

func GetProxyCount() (int64, error)

GetProxyCount 获取当前代理数量

func GetRandomProxy added in v1.3.7

func GetRandomProxy() (string, error)

GetRandomProxy 随机获取一个代理

func InitRedis

func InitRedis(addr string, password string, db int) error

func RemovePreferredProxy added in v1.3.8

func RemovePreferredProxy(proxy string) error

RemovePreferredProxy 从优选代理列表中删除

func RemoveProxy

func RemoveProxy(proxy string) error

RemoveProxy 从代理池中删除指定代理

func ReplaceProxies added in v1.3.7

func ReplaceProxies(proxies []string) error

ReplaceProxies 替换所有代理

Types

This section is empty.

Jump to

Keyboard shortcuts

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