Documentation
¶
Overview ¶
Copyright 2022 rateLimit Author(https://github.com/yudeguang/noGcStaticMap). All Rights Reserved.
This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang/noGcStaticMap.
Copyright 2022 rateLimit Author(https://github.com/yudeguang/noGcStaticMap). All Rights Reserved.
This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang/noGcStaticMap.
Copyright 2022 rateLimit Author(https://github.com/yudeguang/noGcStaticMap). All Rights Reserved.
This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang/noGcStaticMap.
Copyright 2022 rateLimit Author(https://github.com/yudeguang/noGcStaticMap). All Rights Reserved.
This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang/noGcStaticMap.
Copyright 2022 rateLimit Author(https://github.com/yudeguang/noGcStaticMap). All Rights Reserved.
This Source Code Form is subject to the terms of the MIT License. If a copy of the MIT was not distributed with this file, You can obtain one at https://github.com/yudeguang/noGcStaticMap.
Index ¶
- Variables
- func JoinInterface(sep string, elems ...interface{}) string
- func SliceToStr(p []NoGcStructExample) string
- func StructToStr(p NoGcStructExample) string
- type NoGcStaticMapAny
- func (n *NoGcStaticMapAny) Get(k []byte) (v []byte, exist bool)
- func (n *NoGcStaticMapAny) GetDataBeginPosOfKVPair(k []byte) (uint32, bool)
- func (n *NoGcStaticMapAny) GetString(k string) (v string, exist bool)
- func (n *NoGcStaticMapAny) GetUnsafe(k []byte) (v []byte, exist bool)
- func (n *NoGcStaticMapAny) GetValFromDataBeginPosOfKVPairUnSafe(dataBeginPos int) (v []byte)
- func (n *NoGcStaticMapAny) Len() int
- func (n *NoGcStaticMapAny) Set(k, v []byte)
- func (n *NoGcStaticMapAny) SetFinished()
- func (n *NoGcStaticMapAny) SetString(k, v string)
- type NoGcStaticMapHuge
- func (n *NoGcStaticMapHuge) Get(k []byte) (v []byte, exist bool)
- func (n *NoGcStaticMapHuge) GetDataBeginPosOfKVPair(k []byte) (uint32, bool)
- func (n *NoGcStaticMapHuge) GetString(k string) (v string, exist bool)
- func (n *NoGcStaticMapHuge) GetUnsafe(k []byte) (v []byte, exist bool)
- func (n *NoGcStaticMapHuge) GetValFromDataBeginPosOfKVPairUnSafe(dataBeginPos int) (v []byte)
- func (n *NoGcStaticMapHuge) Len() int
- func (n *NoGcStaticMapHuge) Set(k, v []byte)
- func (n *NoGcStaticMapHuge) SetFinished()
- func (n *NoGcStaticMapHuge) SetString(k, v string)
- type NoGcStaticMapInt
- func (n *NoGcStaticMapInt) Get(k int) (v []byte, exist bool)
- func (n *NoGcStaticMapInt) GetDataBeginPosOfKVPair(k int) (uint32, bool)
- func (n *NoGcStaticMapInt) GetString(k int) (v string, exist bool)
- func (n *NoGcStaticMapInt) GetUnsafe(k int) (v []byte, exist bool)
- func (n *NoGcStaticMapInt) GetValFromDataBeginPosOfKVPairUnSafe(dataBeginPos int) (v []byte)
- func (n *NoGcStaticMapInt) Len() int
- func (n *NoGcStaticMapInt) Set(k int, v []byte)
- func (n *NoGcStaticMapInt) SetFinished()
- func (n *NoGcStaticMapInt) SetString(k int, v string)
- type NoGcStaticMapUint32
- func (n *NoGcStaticMapUint32) Get(k uint32) (v []byte, exist bool)
- func (n *NoGcStaticMapUint32) GetDataBeginPosOfKVPair(k uint32) (uint32, bool)
- func (n *NoGcStaticMapUint32) GetString(k uint32) (v string, exist bool)
- func (n *NoGcStaticMapUint32) GetUnsafe(k uint32) (v []byte, exist bool)
- func (n *NoGcStaticMapUint32) GetValFromDataBeginPosOfKVPairUnSafe(dataBeginPos int) (v []byte)
- func (n *NoGcStaticMapUint32) Len() int
- func (n *NoGcStaticMapUint32) Set(k uint32, v []byte)
- func (n *NoGcStaticMapUint32) SetFinished()
- func (n *NoGcStaticMapUint32) SetString(k uint32, v string)
- type NoGcStructExample
Constants ¶
This section is empty.
Variables ¶
var SplitSep = []byte("`")
默认的文本分隔符,一般文本中不会有这个字符
Functions ¶
func JoinInterface ¶
Types ¶
type NoGcStaticMapAny ¶
type NoGcStaticMapAny struct {
// contains filtered or unexported fields
}
func (*NoGcStaticMapAny) GetDataBeginPosOfKVPair ¶
func (n *NoGcStaticMapAny) GetDataBeginPosOfKVPair(k []byte) (uint32, bool)
取出键值对在数据中存储的开始位置
func (*NoGcStaticMapAny) GetString ¶
func (n *NoGcStaticMapAny) GetString(k string) (v string, exist bool)
取出数据,以string的方式
func (*NoGcStaticMapAny) GetUnsafe ¶
func (n *NoGcStaticMapAny) GetUnsafe(k []byte) (v []byte, exist bool)
取出数据 警告:返回的数据是hash表中值的引用,而非值的复制品,要注意不要在外部改变该返回值
func (*NoGcStaticMapAny) GetValFromDataBeginPosOfKVPairUnSafe ¶
func (n *NoGcStaticMapAny) GetValFromDataBeginPosOfKVPairUnSafe(dataBeginPos int) (v []byte)
从内存中的某个位置取出键值对中值的数据 警告: 1)传入的dataBeginPos必须是真实有效的,否则有可能会数据越界; 2)返回的数据是hash表中值的引用,而非值的复制品,要注意不要在外部改变该返回值
func (*NoGcStaticMapAny) SetString ¶
func (n *NoGcStaticMapAny) SetString(k, v string)
增加数据,以string的方式
type NoGcStaticMapHuge ¶
type NoGcStaticMapHuge struct {
// contains filtered or unexported fields
}
其它类型,值最长为65535,此类型无此限制
func NewHuge ¶
func NewHuge(tempFileName ...string) *NoGcStaticMapHuge
初始化 对键值的长度不做限制,除非是存储值的长度超长的情况,否则不建议使用此类型,因为会占用更多的空间
func (*NoGcStaticMapHuge) Get ¶
func (n *NoGcStaticMapHuge) Get(k []byte) (v []byte, exist bool)
取出数据
func (*NoGcStaticMapHuge) GetDataBeginPosOfKVPair ¶
func (n *NoGcStaticMapHuge) GetDataBeginPosOfKVPair(k []byte) (uint32, bool)
取出键值对在数据中存储的开始位置
func (*NoGcStaticMapHuge) GetString ¶
func (n *NoGcStaticMapHuge) GetString(k string) (v string, exist bool)
取出数据,以string的方式
func (*NoGcStaticMapHuge) GetUnsafe ¶
func (n *NoGcStaticMapHuge) GetUnsafe(k []byte) (v []byte, exist bool)
取出数据 警告:返回的数据是hash表中值的引用,而非值的复制品,要注意不要在外部改变该返回值
func (*NoGcStaticMapHuge) GetValFromDataBeginPosOfKVPairUnSafe ¶
func (n *NoGcStaticMapHuge) GetValFromDataBeginPosOfKVPairUnSafe(dataBeginPos int) (v []byte)
从内存中的某个位置取出键值对中值的数据 警告: 1)传入的dataBeginPos必须是真实有效的,否则有可能会数据越界; 2)返回的数据是hash表中值的引用,而非值的复制品,要注意不要在外部改变该返回值
func (*NoGcStaticMapHuge) SetFinished ¶
func (n *NoGcStaticMapHuge) SetFinished()
完成存储把存储到硬盘上的文件复制到内存
func (*NoGcStaticMapHuge) SetString ¶
func (n *NoGcStaticMapHuge) SetString(k, v string)
增加数据,以string的方式
type NoGcStaticMapInt ¶
type NoGcStaticMapInt struct {
// contains filtered or unexported fields
}
func NewInt ¶
func NewInt(tempFileName ...string) *NoGcStaticMapInt
初始化 键的类型为int,值的最大长度为65535,与默认类型相比,速度稍快,稍微节省存储空间
func (*NoGcStaticMapInt) GetDataBeginPosOfKVPair ¶
func (n *NoGcStaticMapInt) GetDataBeginPosOfKVPair(k int) (uint32, bool)
取出键值对在数据中存储的开始位置
func (*NoGcStaticMapInt) GetString ¶
func (n *NoGcStaticMapInt) GetString(k int) (v string, exist bool)
取出数据,以string的方式
func (*NoGcStaticMapInt) GetUnsafe ¶
func (n *NoGcStaticMapInt) GetUnsafe(k int) (v []byte, exist bool)
取出数据 警告:返回的数据是hash表中值的引用,而非值的复制品,要注意不要在外部改变该返回值s
func (*NoGcStaticMapInt) GetValFromDataBeginPosOfKVPairUnSafe ¶
func (n *NoGcStaticMapInt) GetValFromDataBeginPosOfKVPairUnSafe(dataBeginPos int) (v []byte)
从内存中的某个位置取出键值对中值的数据 警告: 1)传入的dataBeginPos必须是真实有效的,否则有可能会数据越界; 2)返回的数据是hash表中值的引用,而非值的复制品,要注意不要在外部改变该返回值
func (*NoGcStaticMapInt) SetString ¶
func (n *NoGcStaticMapInt) SetString(k int, v string)
增加数据,以string的方式
type NoGcStaticMapUint32 ¶
type NoGcStaticMapUint32 struct {
// contains filtered or unexported fields
}
func NewUint32 ¶
func NewUint32(tempFileName ...string) *NoGcStaticMapUint32
初始化 键的类型为int32,值的最大长度为65535,与默认类型相比,速度稍快,稍微节省存储空间
func (*NoGcStaticMapUint32) Get ¶
func (n *NoGcStaticMapUint32) Get(k uint32) (v []byte, exist bool)
取出数据
func (*NoGcStaticMapUint32) GetDataBeginPosOfKVPair ¶
func (n *NoGcStaticMapUint32) GetDataBeginPosOfKVPair(k uint32) (uint32, bool)
取出键值对在数据中存储的开始位置
func (*NoGcStaticMapUint32) GetString ¶
func (n *NoGcStaticMapUint32) GetString(k uint32) (v string, exist bool)
取出数据,以string的方式
func (*NoGcStaticMapUint32) GetUnsafe ¶
func (n *NoGcStaticMapUint32) GetUnsafe(k uint32) (v []byte, exist bool)
取出数据 警告:返回的数据是hash表中值的引用,而非值的复制品,要注意不要在外部改变该返回值
func (*NoGcStaticMapUint32) GetValFromDataBeginPosOfKVPairUnSafe ¶
func (n *NoGcStaticMapUint32) GetValFromDataBeginPosOfKVPairUnSafe(dataBeginPos int) (v []byte)
从内存中的某个位置取出键值对中值的数据 警告: 1)传入的dataBeginPos必须是真实有效的,否则有可能会数据越界; 2)返回的数据是hash表中值的引用,而非值的复制品,要注意不要在外部改变该返回值
func (*NoGcStaticMapUint32) SetFinished ¶
func (n *NoGcStaticMapUint32) SetFinished()
完成存储把存储到硬盘上的文件复制到内存
func (*NoGcStaticMapUint32) SetString ¶
func (n *NoGcStaticMapUint32) SetString(k uint32, v string)
增加数据,以string的方式
type NoGcStructExample ¶
结构体案例
func BytesToStruct ¶
func BytesToStruct(data []byte) (p NoGcStructExample)
高效的对数据进行分割,相比于用系统的Split减少gc的产生,速度更快