Mantra how-to guide

Static cache for MIME files

Mantra core components include "static", a simple and efficient component to cache project MIME types

17-Mar-2022
A  A  A 

Mantra has been designed as an efficient and fast framework so that you can build all the stuff of your project on top of its core functionality. In some way, Mantra acts like a glue for the components of the project, providing all technological functionality to develop decoupled components, multiple data providers, etc.

This is why some features of any high performance project, should be built as components to be included in your porject, so that Mantra doesn't conditionate any project in any way. You can find many useful components in components section of this site.

Anyway, Mantra core includes a simple component called "static", by which you can indicate to Mantra to cache all MIME files included in your components and frontend.

This component has just one property you can optionally set in "ComponentsConfig" section of mantraconfig.json file:

{
   "static": {
      "cache": true
   }
}

If true, then Mantra will cache in memory all files of MIME types included in your frontend and components, like images, HTML views and blocks, scripts and css files, etc.

The recommendation is to set this static and simple cache to false in development and, of course, true in production.