I created a forum and we are implementing the apc and memcache caching solution to keep the database running.
I started to implement a cache level with keys such as "Categories :: getAll", and if I had user-specific data, I would add keys with things like user ID so that you get "User::getFavoriteThreads|1471". When the user added a new favorite stream, I would delete the cache key, and he recreated the record.
However, a problem arises here:
I wanted to cache threads in the forum. Simple enough, "Forum :: getThreads | $ iForumId". But ... With pagination, I would have to split this into multiple cache entries, for example
"Forum::getThreads|$iForumId|$iLimit|$iOffset".
Which is good until someone adds a new topic to the forum. Now I have to delete all the keys in "Forum::getThreads|$iForumId", no matter what the limit and offset.
What would be a good way to solve this problem? I would rather not go over all possible constraints and bias until I find something that no longer matches.
Thanks.
source
share