/autocache

Distributed cache with gossip peer membership enrollment.

Primary LanguageGoApache License 2.0Apache-2.0

Build Status codecov Go Report Card GoDoc LICENSE pomerium chat

Autocache

Groupcache enhanced with memberlist for distributed peer discovery.

TL;DR

See /_example/ for usage.

Run

docker-compose up -f _example/docker-compose.yaml --scale autocache=5

Client

for i in`seq 10`; do curl "http://autocache.localhost/get/?key=hunter2";echo; done
$2a$14$1CCq.8WOxEmLY3jdkwZKIeR1bN/B0jnWwwSKc1VTf60A57VOXKblC
$2a$14$1CCq.8WOxEmLY3jdkwZKIeR1bN/B0jnWwwSKc1VTf60A57VOXKblC
$2a$14$1CCq.8WOxEmLY3jdkwZKIeR1bN/B0jnWwwSKc1VTf60A57VOXKblC
$2a$14$1CCq.8WOxEmLY3jdkwZKIeR1bN/B0jnWwwSKc1VTf60A57VOXKblC
$2a$14$1CCq.8WOxEmLY3jdkwZKIeR1bN/B0jnWwwSKc1VTf60A57VOXKblC
$2a$14$1CCq.8WOxEmLY3jdkwZKIeR1bN/B0jnWwwSKc1VTf60A57VOXKblC
$2a$14$1CCq.8WOxEmLY3jdkwZKIeR1bN/B0jnWwwSKc1VTf60A57VOXKblC
$2a$14$1CCq.8WOxEmLY3jdkwZKIeR1bN/B0jnWwwSKc1VTf60A57VOXKblC
$2a$14$1CCq.8WOxEmLY3jdkwZKIeR1bN/B0jnWwwSKc1VTf60A57VOXKblC
$2a$14$1CCq.8WOxEmLY3jdkwZKIeR1bN/B0jnWwwSKc1VTf60A57VOXKblC

Server

autocache_2  | 2020/01/06 06:10:51 bcryptKey/key:"hunter2"	time:969.8645ms
autocache_2  | 2020/01/06 06:10:51 cacheHandler: group[bcrypt]	key["hunter2"]	time[969.9474ms]
autocache_1  | 2020/01/06 06:10:51 cacheHandler: group[bcrypt]	key["hunter2"]	time[1.3559ms]
autocache_3  | 2020/01/06 06:10:51 cacheHandler: group[bcrypt]	key["hunter2"]	time[1.1236ms]
autocache_4  | 2020/01/06 06:10:51 cacheHandler: group[bcrypt]	key["hunter2"]	time[1.2935ms]
autocache_5  | 2020/01/06 06:10:51 cacheHandler: group[bcrypt]	key["hunter2"]	time[985.2µs]
autocache_6  | 2020/01/06 06:10:51 cacheHandler: group[bcrypt]	key["hunter2"]	time[1.2163ms]
autocache_2  | 2020/01/06 06:10:51 cacheHandler: group[bcrypt]	key["hunter2"]	time[23.3µs]
autocache_1  | 2020/01/06 06:10:51 cacheHandler: group[bcrypt]	key["hunter2"]	time[495.3µs]
autocache_3  | 2020/01/06 06:10:51 cacheHandler: group[bcrypt]	key["hunter2"]	time[497.3µs]
autocache_4  | 2020/01/06 06:10:52 cacheHandler: group[bcrypt]	key["hunter2"]	time[770.5µs]