Lazy Loading

We need your assistance to make the documentation accurate, user friendly and understandable. Therefore we welcome any tips or suggestions regarding documentation. Thank you in advance for your contribution.

However, we will not respond to technical support questions submitted using this form. If you are having difficulty with CMSMS and cannot find the solution on this website, please submit your question appropriately on our support forum at: http://forum.cmsmadesimple.org. Please remember to follow the forum rules when posting.

CMS Made Simple™ Partner



Lazy loading of modules is the concept of only loading a module when it is explicitly required. Thus helping to improve website performance.

CMSMS allows the programmer to choose if a module should be lazy loaded for frontend and/or admin requests, and implements various caching techniques to aide in that. i.e: The admin navigation is cached for each user so that once the cache is built, the module may not be loaded for subsequent requests, until visiting the module's admin panel or utilizing other functionality implemented by the module.

However, there are some disadvantages to lazy loading, and some times where lazy loading must be explicitly disabled depending on the functionality of the module. Therefore it is important to at all time keep the module class as simple and as small as possible, and to relegate functionality as much as possible to other classes, and to action and event files.

  When you can't use Lazy Loading

Frontend Admin
The module uses a tag alias1 Register in install N/A
The module uses Pretty URL's2 Register in install N/A
The module creates content types3 No No
The module handles hooks No No

  Enabling or Disabling Lazy Loading

There are two methods in the CMSModule class that you must override in your module to enable or disable lazy loading: LazyLoadFrontend() and LazyLoadAdmin(). Both if these modules must return a boolean.

public function LazyLoadAdmin() { return true; }
public function LazyLoadFrontend() { return true; }

Note: Because flags that tell CMSMS whether or not to load your module for each request are stored in the database, you must bump the version number of your module each time you change these methods.