Skip to content

Caching

Herodotus includes a built-in caching system for optimal frontend performance.

How It Works

  1. When [herodotus] runs for the first time on a given day, it queries the database for matching events.
  2. The result is stored as a WordPress transient.
  3. Subsequent page loads serve the cached result without hitting the database.
  4. The cache expires based on the configured lifetime (TTL).

Cache Key Structure

Each unique combination of parameters generates a separate cache entry. The key is built as:

herodotus_ + MD5( all_params + day + month + locale + version )

The MD5 hash means each unique combination of shortcode attributes, date, locale and plugin version gets its own cache entry. The locale component ensures that multilingual sites (WPML, Polylang) cache each language version separately.

Cache Invalidation

The cache is automatically cleared when: - A Herodotus post is created, updated, or deleted. - The plugin settings are saved.

You do NOT need to manually clear the cache under normal usage.

Configuring Cache TTL

Go to Settings → Herodotus → Cache Settings.

Value Meaning
0 Caching disabled (every page load queries the DB)
3600 1 hour (default)
86400 24 hours
43200 12 hours

Recommendations:

  • Development/Testing: Set to 0
  • Production (low traffic): 360086400
  • Production (high traffic): 3600

Compatibility with Page-Level Caching Plugins

Herodotus works alongside: - WP Super Cache - W3 Total Cache
- LiteSpeed Cache - WP Rocket - Any other full-page caching plugin

Important Note

Full-page caching plugins cache the entire HTML output of a page. If the page with [herodotus] is cached at the page level, the events shown may become stale after midnight (when "today" changes).

Solutions: 1. Exclude pages containing [herodotus] from full-page cache. 2. Set your page cache TTL to be shorter than 24 hours. 3. Schedule a cache purge at midnight in your timezone.