I understand where you’re coming from, but I have a few questions. In your example above (unless I’m reading it wrong), a write query would just be passed to the database to do its work but it wouldn’t invalidate the select query that’s already cached.
For example, let’s say I run your select query and get all rows where id is greater than 0. The query result is cached and I can use it again next time. Now, I insert 100 rows, update 20, and delete 5. Because the write queries don’t invalidate that select query, running the select query again will get the original results from memcached which are now invalid and out of date. You might say that you can simply invalidate this one query from each of the write queries, but when you have more than one select query that could have potentially cached a row, especially when you start talking about joins, it gets even more complex.
Yeah I agree , but there is no problem with that.
When you need to delete and update $this->load->database() is called.
You need first update or delete to be able to retrieve valid results from the database.
This is the first way to have fresh data.
Other way is set again ( rewrite ) old data. I didnt think about.It depends only of your needs.If you dont need of fresh data anytime that is not a bad idea.
If you want fresh data you can cache data only for one client ( user ). / I mean personal cache.
When you need of more complex stuff , you need of more complex solution.