Implemented a sharded in-memory cache service with TTL expiry and CLOCK eviction for size constraints.
CLOCK eviction algorithm: once the size of a shard is full, to evict, rotate through all entries until we find one that hasn't been referenced since the last time we checked it ("second-chance algorithm").
True LRU eviction requires mutating state per shard on every read to maintain least recently used within a doubly linked list, which offers O(1) eviction, which enables read contention.
CLOCK approximates LRU with a reference/read flag which is set when not already set, keeping all reads lock-free.
A background sweeper is implemented to clean the expired entries on TTL, which will run periodically, locking only one shard at a time.
under /cache-service folder, run make target run using command
make run