Skip to content

Latest commit

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Distributed Consistent Map

In-memory concurrent map which is consistent across machines

Installation

Install: go get github.com/cookingkode/dmap

Usage

// Prep the configconf:=&dmap.Config{
[]string{"localhost:6379", "localhost:7777"}, // your redis hosts
[]int{0, 0}, // DBs of each of the redis hosts32, // local shards : function of how much concurreny is there in the app"test", // Dmap name , used as a namespace for backendtrue, // Want 2Q based LRU?4, // Valid if LRU, no of items in the LRU cache
}
//init // the instance returned is a thread-safe string-> interface{} map// values set in other instances are reflected heredmap:=dmap.New(conf)
// Set without expirydmap.Set("Name", "Cooker", 0)
whatIsMyName : =dmap.Get("Name")
// Set with expiry of 2 sdmap.Set("Foo", "Bar", 2)
// Values are interface and so can change typesdmap.Set("x", 1)
dmap.Set("x", "astring")

Tests

  • see tests/test.go for an interactive shell to test normal map
  • see tests/test_lru.go for an interactive shell to test LRU map
  • TODO : automated tests

About

Distributed consistent hashmap, with 2Q based LRU eviction

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages