Closed dilip-vishwa closed 8 years ago
Which information would you like to have? Getting contents of the cache (keys) is not possible for many backends.
Following information can be shown in debug panel:-
where cache is set
,
which type is used for caching data such as apc, file, db,Dummy, redis, wincache, xcache, zendcache, etc.
,
Various conditions
,
expiration settings and it's duration till now
,
and all other possible information which can be shown.
This feature will give developer a good understanding of cache working in their web application and also works as a debugger.
where cache is set
= log all calls that are setting cache?which type is used for caching data such as apc, file, db,Dummy, redis, wincache, xcache, zendcache, etc.
do you want this info for each call to setting cache?Various conditions
= ?expiration settings and it's duration till now
I'm afraid such info isn't available in many backends at all.The information
Various conditions
is set by developer or it's default value and
for others also same as above.
It will be usefull to see counters of get/set/delete/flush operations with differentiation by storages - this as minimum. As maximum - list of all opeartions in request: storage, operation (get/set/delete/flush), key, duration (for set).
It will help to debug pages/requests in these cases, for example:
Anyone in favor for the event based approach? In yii 1 one had to parse though the log to figure out cache hits/misses. With events, the debug toolbar can listen for class-level events I think:
Event::on(Cache::className(), Cache::EVENT_SET, function ($event) {
// Collect all results for later
// $event->sender can be used to figure out cache backend
// $event might provide: $cacheKey, $success (whether get, set, etc. succeeded)
});
Normal logging like in yii 1 should still be added I guess?
Also a simplified version of the idea
expiration settings and it's duration till now
is possible if cache does store expire timestamp within the cache data (serialize, like with dependency). Then we could see when cache item expires. It could be an optional feature, disabled by default.
Issue moved to https://github.com/yiisoft/yii2-debug/issues/76
If the cache is used in page, then we should get some informative information about the cache component used in particular view, query, fragment, or page, etc. It should also show the content of the particular cache.