A tutorial on implementing the distributed cache GeeCache from scratch in Go (7 days implement golang distributed cache from scratch tutorial), building a distributed cache modeled after groupcache. This article describes using protobuf (protocol buffer) for communication between nodes, encoding messages to improve efficiency.
A tutorial on implementing the distributed cache GeeCache from scratch in Go (7 days implement golang distributed cache from scratch tutorial), building a distributed cache modeled after groupcache. This article introduces the concepts of cache avalanche, cache breakdown and cache penetration, and implements and tests singleflight to prevent cache breakdown.
A tutorial on implementing the distributed cache GeeCache from scratch in Go (7 days implement golang distributed cache from scratch tutorial), building a distributed cache modeled after groupcache. This article adds node registration and node selection to GeeCache, and implements an HTTP client to communicate with the servers of remote nodes.
A tutorial on implementing the distributed cache GeeCache from scratch in Go (7 days implement golang distributed cache from scratch tutorial), building a distributed cache modeled after groupcache. This article introduces the principle of consistent hashing, its implementation, and related test cases: why consistent hashing can prevent cache avalanches, and why virtual nodes solve the problem of data skew.
gomock is the official Go mocking library for unit tests, useful when dependencies such as network requests, databases or file I/O are complex and hard to call directly. This tutorial covers matchers (Any, Nil, Not, Eq), return values (Do, Return, DoAndReturn), call counts (Times) and ordering (InOrder), and how to write mockable code.
7 Days Go Distributed Cache Tutorial Series from scratch (7 days implement golang distributed cache from scratch tutorial). Build a distributed cache by hand, modeled after the implementation of groupcache. This article introduces how to build an HTTP Server with the standard library http, set up an HTTP service for GeeCache's single-node instance, and run the related tests.