Page Cache Hit Rate API

When using a full page cache in PHP, Tideways can be used to calculate the page cache hit rate for the whole service or individual transactions.

There are two ways to record data for the page cache hit rate support in Tideways

  • Automatic instrumentation in the PHP Extension, requiring no extra work.

  • Manual instrumentation via markPageCacheHit and markPageCacheMiss.

Automatic Instrumentation

The following frameworks are automatically instrumented by Tideways:

  • Shopware 6

Manual Instrumentation

If your framework or application is not automatically instrumented, you need to modify your code to record that a request is a page cache hit or miss.

page-cache-example.php
<?php

$item = $cachePool->get($pageName);

if ($item->isHit())
    if (class_exists('Tideways\Profiler')) {
        \Tideways\Profiler::markPageCacheHit();
    }

    // render cached response
} else {
    if (class_exists('Tideways\Profiler')) {
        \Tideways\Profiler::markPageCacheMiss();
    }

    // generate response
}
Still need help? Email [email protected]