Search⌘ K
AI Features

Testing a Basic Concurrent Cache: Implementation

Explore the implementation of a basic concurrent cache in Elixir using gen_server and ETS. Understand its key features, design constraints, and how to prepare it for stateful property-based testing. Gain insight into managing concurrent writes, reading strategies, and cache flushing to identify potential bugs in complex systems.

Understanding the requirements

To use stateful tests, we’ll first need a stateful system to validate. The system we’ll use is a cache implemented as an Open Telecom Platform (OTP) gen_server. A common optimization pattern is to use an Erlang Term Storage (ETS) table for reads and ensure the writers are safe by making them sequential through calls to ...