educative.io

Educative

Which cache should be used to store newsfeeds

The article says
"
Struct { LinkedHashMap<FeedItemID, FeedItem> feedItems; DateTime lastGenerated;}

We can store FeedItemIDs in a data structure similar to Linked HashMap or TreeMap, which can allow us to not only jump to any feed item but also iterate through the map easily.
"

However, normal cache solutions, Redis and memcahced, don’t support that types. How can we construct the cache solution? Do you mean make the solution with an application I build?

Hi @Lee_bonghyun,

Creating a customized cache solution for your design problem is always better when you choose complex data structures not supported by standard cache solutions.

If we have to choose between readily available cache solution – Memcache or Redis – Redis would definitely be a better choice for the above-mentioned design problem. If we go with Redis, we might need to change our data structure choice accordingly, depending on its usability with Redis; it might involve some application layer logic implementation.