Object-Oriented Programming · LinkedIn · Medium
A content management platform needs a fast in-memory cache for key-value pairs, with every value carrying a rank that signals its priority. Since the backing data source is slow, the cache should retain either frequently requested or high-ranked items. When the cache reaches its capacity limit, it must evict the entry whose rank is smallest. If multiple entries tie for the lowest rank, any of them may be evicted. The following interfaces and record class are provided: Java:…