OSF for Drupal Entities Pre-Caching Mechanism
Caching is in integral part of Drupal. How often are you reading "Flush the cache, it should fix you issue". There is a reason for that: nearly everything is caching in a way or another. Caching also has a great impact on a Drupal's site performance depending on certain usecases.
This is for these reasons that we developed a simple set of configuration options in OSF for Drupal to pre-cache Drupal entities. The goal of this feature is to give the possibility to system administrators to populate their cache with all the entities content available on their portal instead of waiting for users to hit a non-cached page to cache it. This may greatly improve the performance of their Drupal portal that is in production.
How does it works?
This feature is really simple. First, it proposes three options to the system administrators:
- To pre-cache all entities that exists in specific datasets
- To pre-cache all entities that exists in specific ontologies
- To pre-cache all entities that exists in specific bundles
Once the system administrator made his choices, then this caching mechanism will get the list of all these entities, and will load all of them using the
entity_load() API call. By using this call, all these entities will be cached.
When is it helpful to run this pre-caching mechanism?
It will be helpful to use this pre-caching mechanism for the following scenarios (do not limit yourself to these, there may be others):
- When you want to make sure that optimal performances for any pages of your Drupal portal
- When you have a Drupal portal that uses multiple field storage systems for a big number of entities
- After you flushed all the cache in Drupal
- After you reloaded an external caching server like Memcached
Using the pre-caching mechanism
To access the pre-caching features, you have to go to the
OSF for Drupal Settings, and then to click on the
In that page, you will have two sections: one that deal with
OSF Entities caching, and one that deal with
Content Type (OSF FieldStorage) caching.
The first section deals with the
OSF Entities caching. From that section, you can select the
datasets and the
ontologies that you would like to pre-cache into Drupal. Once you checked all the things you wanted to pre-cache, you can click the
Pre-cache selected datasets entities button. Once you click that button, you will be redirected to a progress page that will show you the progress of the pre-caching process (see below).
The second section deals with the
Content Type caching. From that section, you can select the
bundles that you would like to pre-cache into Drupal. Once you checked all the things you wanted to pre-cache, you can click the
Pre-cache selected bundles entities button. Once you click that button, you will be redirected to a progress page that will show you the progress of the pre-caching process (see below).
In the batch pre-caching process, you will be notified of the progress of this batch process. If for any reason you are leaving that progress page, do not worry. All the entities that will be cached won't be re-cached another time if you have to re-run the same process. What is cached remain cached.