Testing a Basic Concurrent Cache: Implementation
Take a look at an example of a cache to understand the concepts of stateful properties.
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 the gen_server
. This creates a bit of contention on the write operations, so instead, we’ll try to write a cache that only uses ETS ...