2

Is it possible to use different types of cache in Craft? Yii made a point how different caches are better for different reasons:

Tip: You may use different cache storage in the same application. A common strategy is to use memory-based cache storage to store data that is small but constantly used (e.g. statistical data), and use file-based or database-based cache storage to store data that is big and less frequently used (e.g. page content).

There are some pages that need a decent sized portion of content cached, but other areas in plugins that cache small bits of data. It would be nice if I could declare template cache to be "X" cache type, but use other cache types such as Redis in other areas.

Is it possible at all to do this through Craft?

1

Is it possible at all to do this through Craft?

Probably, but it kind of depends on what level of caching we're talking about and your specific use-case.

There's an overview of the different caching options available in Craft and what they mean here.

| improve this answer | |
  • Superb write up! Bookmarked for checking up on in the future; I did not know that template {% cache %} tags always stored cache in the database, and that specifying cache type in general.php was separate and for plugin-use exclusively. By default it is doing what I wanted, then. Great links, Cold Cache looks awesome. So many easter eggs here. Craft CMS (& the support here) has made web development "fun" in a way it's never been for me before. Thanks, Brad! – taylor Jan 26 '16 at 6:13
  • Glad to hear. :) Moved the answer over to its own question. Caching is complicated and questions around it get asked often enough that there should be a "definitive" place to point people to. – Brad Bell Jan 26 '16 at 6:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.