Cloning Memcached with Go

Click for: original source

Andrew Healey tutorial how to write key value store in Go. He uses caching pretty often but had never coded up a Least Frequently Used (LRU) cache by hand before. Neither had I used Go’s net/http or container/list packages. Both packages are elegant and have great documentation and readable source code – the latter being one of my favorite things about Go.

This time author created two packages. Api – an HTTP server which responds to GET requests like /set?key=name&value=Andrew&expire=1571577784 and /get?key=name. Cache – an LRU cache that allows an expire time and a max number of keys.

The article delves into following:

  • Caching – mapped strings to doubly linked list elements
  • Give key, get value
  • Insert into cache

Author had a great “Google experience” alongside his Go programming. All code included in the tutorial. Superb!

[Read More]

Tags golang programming performance software