util

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	HttpProtocol  = []byte("http://")
	HttpsProtocol = []byte("https://")
)

Functions

func AppendQueryString

func AppendQueryString(dst, queryString []byte) []byte

AppendQueryString appends queryString to dst.

func AppendZeroPaddingUint

func AppendZeroPaddingUint(dst []byte, n, p int) []byte

AppendZeroPaddingUint appends n with zero padding that size of p to dst and returns the extended dst.

func IsHttpOrHttps

func IsHttpOrHttps(u []byte) bool

func IsHttpStatusRedirect

func IsHttpStatusRedirect(status int) bool

func SplitRequestURI

func SplitRequestURI(uri []byte) ([]byte, []byte)

SplitRequestURI splits path and query string.

Types

type Cache

type Cache interface {
	Get(key string) interface{}
	Set(key string, value interface{})
}

Cache is an interface that defines accessor of the cache.

func NewExpireCache

func NewExpireCache(expire int64) Cache

NewExpireCache returns a new cache with the specified expire (ms) and default interval 1 min.

func NewExpireCacheInterval

func NewExpireCacheInterval(expire, interval int64) Cache

NewExpireCacheInterval returns a new cache with the specified expire (ms) and interval (ms).

Jump to

Keyboard shortcuts

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