Cache Bins in Drupal

Modified on Fri, 22 Apr 2022 at 02:31 PM

This article details how the Schema App Drupal module caches markup for Drupal pages. For a general overview of the Drupal module, see Schema App Drupal Module: How IT Works.

Cache Bins

The Schema App Drupal module creates a 'cache bin' to store schema markup for your pages. The implementation is different for each version of the module, but in both cases when a page is loaded the module will check if the cache bin contains a key for this URL, and will retrieve it from our CDN if it does not.

Each item in the cache bin contains a key (based on the page URL), value (schema markup retrieved from our CDN), and expiry time (default is 24 hrs, but this can be configured in the module's settings). 

Drupal 7.x

The Schema App Drupal 7.x module creates a cache bin named 'cache_schemaappto store markup.

This cache bin is a table in the SQL database, and is created using an implementation of hook_schema() in the Drupal 7.x module's installation file. Rows are set using the Drupal 7.x cache_set() function, and are retrieved via the cache_get() function.

Drupal 8.x/9.x

The Schema App Drupal 8.x/9.x module creates a cache bin name 'schemaapp_cache' to store markup.

Caching in Drupal 8.x/9.x uses the Drupal Cache API, where the contents of the cache bin are retrieved using the CacheBackendInterface, using set() to store markup in the cache bin and get() to retrieve cached markup.

The CacheBackendInterface is an abstraction over many types of implementations of a cache. By default Drupal 8.x/9.x uses a database implementation to store cache bins as database tables, but there are many other implementations available such as Varnish, Memcache, and Redis.

  • An overview of Drupal 8.x/9.x caching can be found here: Cache API.
  • Recommendations for clearing the Drupal 8.x/9.x cache can be found here: Clearing the Cache.

Database table replication

If you have a strategy in place to replicate database tables for your Drupal site, we do not recommend including the Schema App Drupal module's cache bin tables, as this cached schema markup will still be available to fetch from Schema App's CDN which is replicated over multiple regions.

In the event of rebuilding the cache for your Drupal site, there would be a small impact on the initial page load speed when first retrieving the markup from our CDN & caching the markup in the cache bin for each page.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article