cmap

package module
v0.0.0-...-90cc831 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

README

go实现一个分片的哈希表

使用方法:

// 线程安全
cs := NewCamp()
cs.Set("shgopher",shgopher)
cs.Get("shgopher")

本方法就是一种使用了,一致性哈希,然后将问题分布式的一种算法。通过哈希函数,将这些写入和读取的过程分为不同的组去处理,然后锁的颗粒度自然就降低了

Documentation

Index

Constants

View Source
const (
	PIECE_NUMBER = 32
)

Variables

This section is empty.

Functions

func FnvHash

func FnvHash(key string) uint32

Types

type CampSlice

type CampSlice []*cmap

func NewCmap

func NewCmap() CampSlice

func (CampSlice) Get

func (c CampSlice) Get(key string) interface{}

func (CampSlice) Set

func (c CampSlice) Set(key string, value interface{})

Jump to

Keyboard shortcuts

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