#CakePHP-2671 Implementing example cache requests logging. #675

Closed
wants to merge 1 commit into from

4 participants

@jbutkus

This is an example cache logging implementation.

It is a response to Mark Story comment:
http://cakephp.lighthouseapp.com/projects/42648/tickets/2671-cache-statistics-generation-feature-request#ticket-2671-4

Hopy it could be incorporated, by some mean, into CakePHP core.

@jrbasso
CakePHP member

I liked the idea, but please store the log only when debug is enabled. Also make a limit to insert in the array, otherwise you can kill the memory.

@ADmad
CakePHP member

Please make the pull request against 2.2 branch. 2.1 will not have any new features.

@markstory
CakePHP member

Wouldn't it make more sense to the the logging framework to do the logging?

@jbutkus

@jrbasso - limit is used in DboSource, and I have reviewed the idea. Don't you think, that if we reach that many cache operations, that logging them may exhaust memory, we would have an issue with memory elsewhere? On the other hand - I see the purpose; as with DB queries logging, sometimes it is enough to see "displaying 200 of 123212312 queries" to understand, that you did something wrong.

@ADmad - thank you, I will re-pull (2.2), incorporate suggestions and create a new pull request. Shall I close this pull request, or will you ignore/close it for yourself?

@markstory - have I missed something from CakePHP core, that could provide something like this? If yes - I would be glad to hear, as I feel like re-inventing the weel every time I need to do some logging? Otherwise - may I try to suggest something on the lines of logging utility as well?

@markstory
CakePHP member

CakeLog can write log files, and in 2.2 its been expanded quite a bit as well. I don't see a reason why you couldn't log cache misses and hits. You might loose the ability to see it on the page, but I don't know how useful that is anyways. Generally I've wanted to know cache hit ratio in aggregate instead of on a single page.

@jbutkus

For cache hit rates I prefer APC/memcached analytics (i.e. we use Cacti graphics).
Although for multi-site installations the results skew might hide actual datum.

For production use - cache hit rates may require a little bit more logics; i.e. offloading actual data writes to external process (backgrounding task), as otherwise it could destroy the benefits of caching itself.

I shall see to CakeLog - so far I have used it in an Object::log($message, $severity) manner.

@jbutkus

I reject this pull request. Will create new soon, based on 2.2 branch.

@jbutkus jbutkus closed this Jun 5, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment