A simple least frequency used cache. Non-thread-safe.
Clears the cache and call onDiscard for all cached entries.
Gets the key and corresponding value (if exists), and increases its access count.
Sets the key and corresponding value, and discards one of the least-used keys if full.