oxhq / cachelet-model
Eloquent model integration for Cachelet.
v0.2.2
2026-04-24 15:17 UTC
Requires
- php: ^8.2
- illuminate/database: ^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-model.
Eloquent model integration for Cachelet.
Install
composer require oxhq/cachelet-model
Features
Cachelet::forModel($model)$model->cachelet()scope(...)for explicit intervention boundariesonly(),exclude(),withDates(),withTimestamps()- Observer-driven invalidation
- Canonical
module = modelcoordinates and telemetry
Example
use Oxhq\Cachelet\ValueObjects\CacheScope; use Oxhq\Cachelet\Traits\UsesCachelet; class User extends Model { use UsesCachelet; } $scope = /* CacheScope instance for the intervention boundary */; $profile = $user->cachelet() ->scope($scope) ->exclude(['updated_at']) ->remember(fn () => $user->fresh());
If you do not define a scope explicitly, cachelet-model infers one from the model cache prefix boundary it already uses for invalidation.