utils

package
v0.0.0-...-1337258 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAndCreateFile

func CheckAndCreateFile(filePath string, flag int, perm os.FileMode) (*os.File, error)

func Env

func Env() string

func GetValueOnEnv

func GetValueOnEnv(prod, test interface{}) interface{}

func Int64Ptr

func Int64Ptr(v int64) *int64

func IsTest

func IsTest() bool

func MaxInt64

func MaxInt64(a, b int64) int64

func MinInt64

func MinInt64(a, b int64) int64

Types

type Lru

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

func NewLRU

func NewLRU(size int) *Lru

func (*Lru) Read

func (lru *Lru) Read(key interface{}) interface{}

func (*Lru) Remove

func (lru *Lru) Remove(key interface{}) interface{}

func (*Lru) Traverse

func (lru *Lru) Traverse(do func(item interface{}) error, skipErr bool) error

Traverse 遍历lru中的存储元素,对每个元素执行do方法 如果执行do方法过程中出现错误,Traverse 会根据 skipErr 决定是否忽略错误,即当 skipErr 为true时,Traverse 不会返回错误 当 skipErr 为false时,Traverse 会返回第一个出现的错误

func (*Lru) Write

func (lru *Lru) Write(key, data interface{}) interface{}

todo:lock性能

type UnboundChan

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

func NewUnboundChan

func NewUnboundChan() *UnboundChan

func (*UnboundChan) Close

func (uc *UnboundChan) Close()

func (*UnboundChan) In

func (uc *UnboundChan) In()

func (*UnboundChan) Len

func (uc *UnboundChan) Len() int64

func (*UnboundChan) Out

func (uc *UnboundChan) Out() bool

Jump to

Keyboard shortcuts

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