Documentation ¶
Overview ¶
HashMap defines a high performance hashmap based on fast hashing and fast key comparison. Simple chaining is used, relying on the hashing algorithms for good distribution
Index ¶
- Variables
- type Entry
- type HashMap
- func (h *HashMap) All() []interface{}
- func (h *HashMap) AllKeys() [][]byte
- func (h *HashMap) Count() uint32
- func (h *HashMap) Get(key []byte) interface{}
- func (h *HashMap) Remove(key []byte)
- func (h *HashMap) RemoveRandom()
- func (h *HashMap) Set(key []byte, data interface{})
- func (h *HashMap) Stats() *Stats
- type Stats
Constants ¶
This section is empty.
Variables ¶
var DefaultHash = hash.Jesteress
DefaultHash to be used unless overridden.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
// contains filtered or unexported fields
}
Entry represents what the map is actually storing. Uses simple linked list resolution for collisions.
type HashMap ¶
HashMap stores Entry items using a given Hash function. The Hash function can be overridden.
func New ¶
func New() *HashMap
New creates a new HashMap of default size and using the default Hashing algorithm.
func NewWithBkts ¶
NewWithBkts creates a new HashMap using the bkts slice argument. len(bkts) must be a power of 2.
func (*HashMap) RemoveRandom ¶
func (h *HashMap) RemoveRandom()
RemoveRandom can be used for a random policy eviction. This is stochastic but very fast and does not impede performance like LRU, LFU or even ARC based implementations.