oxhq/cachelet-model

Eloquent model integration for Cachelet.

Maintainers

Package info

github.com/oxhq/cachelet-model

Homepage

Issues

pkg:composer/oxhq/cachelet-model

Statistics

Installs: 4

Dependents: 1

Suggesters: 0

Stars: 0

v0.3.1 2026-05-14 18:26 UTC

This package is auto-updated.

Last update: 2026-05-15 04:25:49 UTC


README

Eloquent model caching with Cachelet coordinates.

cachelet-model gives model-derived cache entries a stable module identity, inspectable key payloads, and observer-driven invalidation for model cache families.

Install

composer require oxhq/cachelet-model

Best Fit

Use this package when stale model variants and invalidation blast radius are the main pain.

It provides:

  • Cachelet::forModel(...)
  • $model->cachelet()
  • only(...), exclude(...), withDates(), and withTimestamps()
  • observer-driven invalidation for model prefixes
  • canonical module = model coordinates and telemetry

Example

use Oxhq\Cachelet\Traits\UsesCachelet;

class User extends Model
{
    use UsesCachelet;
}

$profile = $user->cachelet()
    ->exclude(['updated_at'])
    ->ttl(300)
    ->remember(fn () => $user->fresh());

Docs