oxhq / cachelet-request
Request and response caching integration for Cachelet.
v0.2.2
2026-04-24 23:35 UTC
Requires
- php: ^8.2
- illuminate/auth: ^12.0|^13.0
- illuminate/http: ^12.0|^13.0
- illuminate/routing: ^12.0|^13.0
- oxhq/cachelet-core: ^0.2
This package is auto-updated.
Last update: 2026-04-25 09:51:10 UTC
README
Read-only split of the Cachelet monorepo package at packages/cachelet-request.
Request and response caching integration for Cachelet.
Install
composer require oxhq/cachelet-request
Features
- Route
->cachelet()integration - Middleware-driven response caching
scope(...)support on request cache profiles- Vary by query string, headers, locale, and authenticated user
- Namespace invalidation for request caches
- Canonical
module = requestcoordinates and telemetry
Example
use Oxhq\Cachelet\ValueObjects\CacheScope; $scope = /* CacheScope instance for the intervention boundary */; Route::get('/users', UserIndexController::class) ->name('users.index') ->cachelet(600, [ 'vary' => ['query' => true, 'auth' => true], 'namespace' => 'users', 'scope' => $scope, ]);
If you do not define a scope explicitly, cachelet-request infers one from the route or namespace prefix boundary it already uses for request-cache grouping.
Request Contract
cachelet-request caches only configured cacheable methods and statuses. In 0.2.x that means:
- methods default to
GETandHEAD - statuses default to
200 - streamed and binary responses are bypassed
- non-cacheable refresh callbacks keep the last cacheable payload during SWR instead of replacing it with an invalid response shape
Vary dimensions are explicit:
- query string, full or partial
- selected headers
- authenticated user identity vs guest
- locale
- custom payload callback
Use namespace or route-prefix invalidation for request caches. Do not assume CDN/proxy cache orchestration or fragment caching in this module.