What is warming up a cleared cache?

The purpose is to initialize any cache that will be needed by the application and prevent the first user from any significant “cache hit” where the cache is generated dynamically.

from http://symfony.com/doc/current/reference/dic_tags.html#kernel-cache-warmer

Real world example: you give some stats that need to be cached so you can write your own service that will be called onto kernel.cache_warmer event to perform this task "statically".


Cache warming is to generate new cache for your application. So when a user requests to open a page of your app, it can read data from the generated cache and give it back in return.

Cache cleaning is literally cleaning the old cache. If you do cache cleaning and not warming up, when a new request come, the application will do all the jobs it needs to retrieve data and to generate new cache and then return the result. If cache has been warmed up before that, then it will be directly returned, so it would be much faster response.

When installing a new bundle.. You install a new bundle to use it then in your app. So you do changes to source code like registering the bundle as a service, calling that service from your controllers for example and this kind of things. But the cache that was previously generated doesn't know about those changes. So cache should be cleaned and generated again (warmed up) to take the changes in mind. Not a deep answer I guess, but trying to give it a simple explanation.