Memory Cache
A memory cache is a straightforward storage paradigm. One suitable example of a memory cache is a dictionary,
where values are stored and retrieved using a key.
Distinct from a dictionary, the data in a memory cache can go stale based on a specified time to live (TTL) duration.
Additionally, it has a maximum capacity. Once the cache's capacity reaches its limit, the least-recently-used key-value
pair is removed and replaced with the incoming value.
This particular cache should be able to hold a maximum of 100 entries, with a TTL of 60 seconds.
It is important to note that both the key and the value are always strings.
Bonus
- Enable the TTL and maximum size to be read from a configuration file. Make sure to handle scenarios where the configuration file is not present or contains negative TTL or size limits.
- Additionally, allow the value type to be specified through the configuration file. This includes options such as int, double, or MyAwesomeType. The cache should accommodate both primitive and custom object types.