We suppose QPS is 100, and there are 10% of content will be written into cache. Each item is 0.5mb, so the storage would be 5 MB/s, which is about 400 GB/day, and 150 TB/year.
For cacheCheck, return the resource if we find the key {resource_id} in the cache, and the resource u is still valid.
For cacheWrite, if cacheCheck is false, it will be called to request content from the server, and write the key-value into the cache. To increase the performance, it can be run asynchronously. Consider the contents are static and does not require strong consistency. It's reasonable.
For cacheClear, we will delete all key-value in the cache.
For cacheExpel, we will de-associate keys and values which are invalid according to some strategy, like LFU, LRU, TTL.
Database should be divided into memory cached database and persistent database. For contents which are most frequently accessed, we can store them in redis. Focus on AP.
For meta data of resources, we can use SQL like postgreSQL, the columns should include resource_id, expired_date, last_updated, URL. Focus on CP.
Explain any trade offs you have made and why you made certain tech choices...
Try to discuss as many failure scenarios/bottlenecks as possible.
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?