duckmap

package module
v0.0.0-...-c6e432c Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2017 License: MIT Imports: 5 Imported by: 0

README

Duckmap

Build Status Go Report Card

About

This is concurrent and DRY interface to interface map.

Quickstart

// pass a number of buckets to the constructor
// higher the number - faster the map (caveat memory usage)
m := duckmap.NewMap(256)

m.Set(4, "this")
m.Set(5, "that")

m.Delete(5)

fmt.Println(m.Keys())
fmt.Println(m.Values())

fmt.Println(4, m.Get(4).(string))
fmt.Println(5, m.Get(5))
Benchmarks
Benchmark_duckmap_parallel_write-4   	 3000000	       446 ns/op	     116 B/op	       2 allocs/op
Benchmark_duckmap_parallel_read-4    	10000000	       155 ns/op	       8 B/op	       0 allocs/op
Benchmark_map_parallel_write-4       	 2000000	       803 ns/op	     175 B/op	       2 allocs/op
Benchmark_map_parallel_read-4        	10000000	       145 ns/op	       0 B/op	       0 allocs/op

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

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

Map is awesome lockfree hashtable

func NewMap

func NewMap(concurrency int) *Map

NewMap is a constructor for the Map

func (*Map) Delete

func (m *Map) Delete(key interface{})

Delete removes entry

func (*Map) Get

func (m *Map) Get(key interface{}) (result interface{})

Get reads entry

func (*Map) Keys

func (m *Map) Keys() []interface{}

Keys returns map keys

func (*Map) Set

func (m *Map) Set(key, value interface{})

Set adds or replaces entry

func (*Map) String

func (m *Map) String() string

func (*Map) Values

func (m *Map) Values() []interface{}

Values returns map values

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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