Skip to content

Cache Collector

Captures cache operations (get, set, delete) with hit/miss rates, timing, and per-pool breakdowns.

Cache Collector panel

What It Captures

FieldDescription
poolCache pool name (e.g., default, sessions)
operationOperation type (get, set, delete, has, clear)
keyCache key
hitWhether the operation was a cache hit
durationOperation execution time in seconds
valueCached value (for get/set operations)

Data Schema

json
{
    "operations": [
        {
            "pool": "default",
            "operation": "get",
            "key": "user:42",
            "hit": true,
            "duration": 0.0003,
            "value": {"name": "John"}
        }
    ],
    "hits": 8,
    "misses": 2,
    "totalOperations": 10
}

Summary (shown in debug entry list):

json
{
    "cache": {
        "hits": 8,
        "misses": 2,
        "totalOperations": 10
    }
}

Contract

php
use AppDevPanel\Kernel\Collector\CacheCollector;
use AppDevPanel\Kernel\Collector\CacheOperationRecord;

$collector->logCacheOperation(new CacheOperationRecord(
    pool: 'default',
    operation: 'get',
    key: 'user:42',
    hit: true,
    duration: 0.0003,
    value: ['name' => 'John'],
));

How It Works

Framework adapters intercept PSR-16 CacheInterfacePsr\SimpleCache\CacheInterfacePSR-16 Simple Cache Interface. Defines basic cache operations.PSR-16 · interface operations through the CacheInterfaceProxy decorator. Every get(), set(), delete(), has(), and clear() call is automatically captured.

Debug Panel

  • Hit rate summary — total operations, hits, misses with percentage
  • Per-pool breakdown — statistics grouped by cache pool when multiple pools are used
  • Operation list — filterable list with operation type, key, hit/miss status, and timing
  • Color coding — hits (green), misses (orange), deletes (yellow)
  • Value preview — expandable cached values for get/set operations

Released under the MIT License.