Documentation ¶
Overview ¶
线程安全、持久化的map 包含一个持久化的map和一个先进先出的队列 fangyousong 2023/3/17
Index ¶
- Variables
- func AcquireTimer(timeout time.Duration) *time.Timer
- func BytesMd5(b []byte) (string, error)
- func Daemonize(nochdir, noclose int) intdeprecated
- func FileExists(file string) bool
- func FileMd5(fn string) (string, error)
- func FileModTime(file string) string
- func FilePathExists(filePath string) bool
- func GBK2UTF8(srcGbk []byte) ([]byte, error)
- func GetExeName() string
- func GetExePath() string
- func GetFloatValue(v interface{}) (float64, bool)
- func GetIntValue(v interface{}) (int64, bool)
- func GetIntValueDefault(v interface{}, dft int64) int64
- func GetStringValue(v interface{}) string
- func Gunzip(data []byte) ([]byte, error)
- func Gzip(data []byte) ([]byte, error)
- func InStringList(list []string, s string) bool
- func IsUtf8(bts []byte) bool
- func JsonMarshalNoHtmlEncode(t interface{}) ([]byte, error)
- func LogStack(fd *os.File)
- func Md5(b []byte) ([]byte, error)
- func Rc4(key []byte, data []byte) []byte
- func ReleaseTimer(t *time.Timer)
- func RestartProcess(keepFiles []*os.File, envVars []string, cleaner func() error) error
- func SplitByLine(s string) (ret []string)
- func SplitLR(s string, separator string) (l string, r string)
- func StringMd5(s string) (string, error)
- func UTF82GBK(srcUtf8 []byte) ([]byte, error)
- func UnsafeBytesToString(b []byte) string
- func UnsafeStringToBytes(s string) (b []byte)
- func UrlEncodedMarshal(structObj interface{}) string
- type CachedFile
- type Context
- type DefaultContext
- type DefaultErrorHolder
- type Error
- type ErrorHolder
- type FileInfoListModTimeAsc
- type FileInfoListModTimeDesc
- type FileMap
- func (m *FileMap) Close()
- func (m *FileMap) Delete(key string)
- func (m *FileMap) Flush()
- func (m *FileMap) Get(key string) []byte
- func (m *FileMap) Len() int
- func (m *FileMap) Pop(waitTimeout time.Duration) (retKey string, timeout bool)
- func (m *FileMap) Put(key string, packedJsonData []byte, overrideIfExists bool, ...) error
- func (m *FileMap) RemoveExpiredData()
- type JsonFloat64
- type JsonInt
- type JsonStr
- type LRUFileCache
- type LRUFileCacheStatis
- type LRUFileStatis
- type LinkedList
- func (m *LinkedList) Delete(node *LinkedNode)
- func (m *LinkedList) InsertAfter(data interface{}, relative *LinkedNode) bool
- func (m *LinkedList) InsertBefore(data interface{}, relative *LinkedNode) bool
- func (m *LinkedList) Iterate(iterator func(data interface{}, canceled *bool))
- func (m *LinkedList) PopHead(lock bool) interface{}
- func (m *LinkedList) PopTail(lock bool) interface{}
- func (m *LinkedList) PushHead(data interface{}, lock bool)
- func (m *LinkedList) PushTail(data interface{}, lock bool)
- func (m *LinkedList) ReverseIterate(iterator func(nodeData interface{}, canceled *bool))
- type LinkedNode
- type Queue
- type RingQueue
- func (m *RingQueue) PopHead(waitTime time.Duration) (interface{}, error)
- func (m *RingQueue) PopTail(waitTime time.Duration) (interface{}, error)
- func (m *RingQueue) PushHead(value interface{}, waitTime time.Duration) error
- func (m *RingQueue) PushTail(value interface{}, waitTime time.Duration) error
- func (m *RingQueue) Size() int
- type SafeRand
- type TokenBucket
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrorFileSizeLimited = errors.New("file size limited") ErrorFileNotExists = errors.New("file not exists") ErrorFileNotModified = errors.New("file not modified") )
View Source
var MaxMapFileSize int64 = 1024 * 1024 * 1024
View Source
var MimeTypeMap map[string]string = map[string]string{}/* 103 elements not displayed */
Functions ¶
func FileExists ¶
func FileModTime ¶
func FilePathExists ¶ added in v1.2.4
func GetExeName ¶ added in v1.4.6
func GetExeName() string
func GetExePath ¶ added in v1.4.6
func GetExePath() string
func GetFloatValue ¶ added in v1.4.6
func GetIntValue ¶ added in v1.4.6
func GetIntValueDefault ¶ added in v1.4.6
func GetStringValue ¶ added in v1.3.5
func GetStringValue(v interface{}) string
func InStringList ¶ added in v1.4.6
func JsonMarshalNoHtmlEncode ¶ added in v1.4.6
func ReleaseTimer ¶ added in v1.4.6
func RestartProcess ¶
func SplitByLine ¶
func UnsafeBytesToString ¶ added in v1.4.10
func UnsafeStringToBytes ¶ added in v1.4.10
func UrlEncodedMarshal ¶ added in v1.3.5
func UrlEncodedMarshal(structObj interface{}) string
Types ¶
type CachedFile ¶ added in v1.4.6
type DefaultContext ¶ added in v1.4.7
type DefaultContext struct { WithLock bool // contains filtered or unexported fields }
func (*DefaultContext) GetCtxData ¶ added in v1.4.7
func (m *DefaultContext) GetCtxData(key string) (interface{}, bool)
func (*DefaultContext) RemoveCtxData ¶ added in v1.4.7
func (m *DefaultContext) RemoveCtxData(key string)
func (*DefaultContext) SetCtxData ¶ added in v1.4.7
func (m *DefaultContext) SetCtxData(key string, value interface{})
type DefaultErrorHolder ¶ added in v1.4.7
type DefaultErrorHolder struct {
// contains filtered or unexported fields
}
func (*DefaultErrorHolder) GetError ¶ added in v1.4.7
func (m *DefaultErrorHolder) GetError() error
func (*DefaultErrorHolder) SetError ¶ added in v1.4.7
func (m *DefaultErrorHolder) SetError(err error)
type ErrorHolder ¶ added in v1.4.7
type FileInfoListModTimeAsc ¶ added in v1.4.10
文件列表按修改时间从旧到新排序
func (FileInfoListModTimeAsc) Len ¶ added in v1.4.10
func (p FileInfoListModTimeAsc) Len() int
func (FileInfoListModTimeAsc) Less ¶ added in v1.4.10
func (p FileInfoListModTimeAsc) Less(i, j int) bool
func (FileInfoListModTimeAsc) Swap ¶ added in v1.4.10
func (p FileInfoListModTimeAsc) Swap(i, j int)
type FileInfoListModTimeDesc ¶ added in v1.4.10
文件列表按修改时间从新到旧排序
func (FileInfoListModTimeDesc) Len ¶ added in v1.4.10
func (p FileInfoListModTimeDesc) Len() int
func (FileInfoListModTimeDesc) Less ¶ added in v1.4.10
func (p FileInfoListModTimeDesc) Less(i, j int) bool
func (FileInfoListModTimeDesc) Swap ¶ added in v1.4.10
func (p FileInfoListModTimeDesc) Swap(i, j int)
type FileMap ¶ added in v1.4.10
持久化的map
func NewFileMap ¶ added in v1.4.10
func (*FileMap) RemoveExpiredData ¶ added in v1.4.10
func (m *FileMap) RemoveExpiredData()
type JsonFloat64 ¶ added in v1.3.5
type JsonFloat64 float64
func (*JsonFloat64) Scan ¶ added in v1.4.6
func (m *JsonFloat64) Scan(value interface{}) error
func (*JsonFloat64) UnmarshalJSON ¶ added in v1.3.5
func (m *JsonFloat64) UnmarshalJSON(bts []byte) error
type LRUFileCache ¶ added in v1.4.6
type LRUFileCache struct {
// contains filtered or unexported fields
}
func NewLRUFileCache ¶ added in v1.4.6
func NewLRUFileCache(fileSizeLimit int64, cacheSizeLimit int64) *LRUFileCache
func (*LRUFileCache) Clear ¶ added in v1.4.6
func (m *LRUFileCache) Clear()
func (*LRUFileCache) Get ¶ added in v1.4.6
func (m *LRUFileCache) Get(abstractFilePath string, since time.Time) (*CachedFile, error)
func (*LRUFileCache) GetStatis ¶ added in v1.4.6
func (m *LRUFileCache) GetStatis() *LRUFileCacheStatis
type LRUFileCacheStatis ¶ added in v1.4.6
type LRUFileCacheStatis struct { FileCount int `json:"file_count"` CacheSize int64 `json:"cache_size"` FileList []LRUFileStatis `json:"file_list"` }
type LRUFileStatis ¶ added in v1.4.6
type LinkedList ¶
type LinkedList struct { Len int // contains filtered or unexported fields }
双向链表
func NewLinkedList ¶
func NewLinkedList(threadSafe bool) *LinkedList
func (*LinkedList) Delete ¶
func (m *LinkedList) Delete(node *LinkedNode)
func (*LinkedList) InsertAfter ¶
func (m *LinkedList) InsertAfter(data interface{}, relative *LinkedNode) bool
func (*LinkedList) InsertBefore ¶
func (m *LinkedList) InsertBefore(data interface{}, relative *LinkedNode) bool
func (*LinkedList) Iterate ¶
func (m *LinkedList) Iterate(iterator func(data interface{}, canceled *bool))
func (*LinkedList) PopHead ¶
func (m *LinkedList) PopHead(lock bool) interface{}
func (*LinkedList) PopTail ¶
func (m *LinkedList) PopTail(lock bool) interface{}
func (*LinkedList) PushHead ¶
func (m *LinkedList) PushHead(data interface{}, lock bool)
func (*LinkedList) PushTail ¶
func (m *LinkedList) PushTail(data interface{}, lock bool)
func (*LinkedList) ReverseIterate ¶
func (m *LinkedList) ReverseIterate(iterator func(nodeData interface{}, canceled *bool))
type LinkedNode ¶
type LinkedNode struct { PriorNode *LinkedNode NextNode *LinkedNode Data interface{} }
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
由多个环形队列拼接成的长队列,借鉴了c++ stl中dequeue的思想
type RingQueue ¶
type RingQueue struct {
// contains filtered or unexported fields
}
环形双向队列
func NewRingQueue ¶
type TokenBucket ¶ added in v1.2.4
type TokenBucket struct {
// contains filtered or unexported fields
}
令牌桶,用于限流. 令牌生产的时间间隔固定为100ms,每次生产的令牌数根据qps的大小计算出: qps/10+1
func NewTokenBucket ¶ added in v1.2.4
func NewTokenBucket(capacity int64, qps int64) *TokenBucket
Source Files ¶
Click to show internal directories.
Click to hide internal directories.