utils

package
v1.3.9 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxCacheDataSize = 1024
)

Variables

View Source
var SharedCache = ttlcache.NewCache[int8]()

Functions

func CheckSearchEngine added in v1.3.9

func CheckSearchEngine(ip string) bool

CheckSearchEngine check if ip is from search engines

func ComposeIPType added in v1.3.0

func ComposeIPType(setId int64, req requests.Request) string

ComposeIPType 组合IP类型

func MatchBytesCache

func MatchBytesCache(regex *re.Regexp, byteSlice []byte, cacheLife CacheLife) bool

MatchBytesCache 正则表达式匹配字节slice,并缓存结果

func MatchStringCache

func MatchStringCache(regex *re.Regexp, s string, cacheLife CacheLife) bool

MatchStringCache 正则表达式匹配字符串,并缓存结果

Types

type CacheLife added in v1.2.10

type CacheLife = int64
const (
	CacheDisabled   CacheLife = 0
	CacheShortLife  CacheLife = 600
	CacheMiddleLife CacheLife = 1800
	CacheLongLife   CacheLife = 7200
)

Jump to

Keyboard shortcuts

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