Chapter 19. View Caching

Table of Contents

19.1. What is it ?
19.2. How Does it Work ?
19.2.1. Activating the cache
19.2.2. The $cacheAction Controller Variable
19.2.3. Marking Content in the View
19.2.4. Clearing the cache
19.3. Things To Remember

19.1. What is it ?

Since 0.10.9.2378_final, Cake has support for view caching (also called Full Page Caching ). No, we are not kidding. You can now cache your layouts and views. You can also mark parts of your views to be ignored by the caching mechanism. The feature, when used wisely, can increase the speed of your app by a considerable amount.

When you request a URL, Cake first looks to see if the requested URL isn't already cached. If it is, Cake bypasses the dispatcher and returns the already rendered, cached version of the page. If the page isn't in the cache, Cake behaves normally.

If you've activated Cake's caching features, Cake will store the output of its normal operation in the cache for future user. The next time the page is requested, Cake will fetch it from the cache. Neat, eh? Let's dig in to see how it works.