Get Cache Remaining Time

Well, I’ve been trying to save the time when a query is cached, but with no success, so I could show the remaining time on my app.

I tried to follow the flow from:

Posts::model()->cache($time, $dependency)->....

And interfer with the cache method but I couldn’t find how it checks the remaining time.

What is the better way to achieve this?

CCache has no way of revealing the remaining ttl of a cached item. You’ve got to extract this information from the caching backend, I’m afraid.