Testing a Basic Concurrent Cache: Implementation
Explore the implementation of a basic concurrent cache using Erlang's OTP gen_server and ETS. Understand the cache's requirements, including key-value handling, eviction, and concurrency. Learn how to model the cache for stateful property testing and prepare it for integration testing in real-world scenarios.
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 writes are safe by making them ...