PHPackages                             oxhq/cachelet - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. oxhq/cachelet

ActiveProject[Caching](/categories/caching)

oxhq/cachelet
=============

The full Cachelet suite for Laravel.

v0.3.1(2mo ago)03[1 PRs](https://github.com/oxhq/cachelet/pulls)MITPHPPHP ^8.2CI passing

Since Apr 20Pushed 1mo agoCompare

[ Source](https://github.com/oxhq/cachelet)[ Packagist](https://packagist.org/packages/oxhq/cachelet)[ Docs](https://github.com/oxhq/cachelet)[ RSS](/packages/oxhq-cachelet/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (6)Dependencies (10)Versions (10)Used By (0)

Cachelet
========

[](#cachelet)

[![Tests](https://github.com/oxhq/cachelet/actions/workflows/tests.yml/badge.svg)](https://github.com/oxhq/cachelet/actions/workflows/tests.yml)[![Latest Version](https://camo.githubusercontent.com/44a07a13b5b45181932f14632ccd8b52af8e33c11cdca7029f480e28d9ded7d9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f7868712f63616368656c65742e737667)](https://packagist.org/packages/oxhq/cachelet)[![License](https://camo.githubusercontent.com/465b6238fe7ea8d1be7e68e136f3db68ff6d6d5513a400c96c23b261ffed99e5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6f7868712f63616368656c65742e737667)](LICENSE)

**The cache operations layer for Laravel.**

Stop flushing blind.

Cachelet gives every important cache entry a stable coordinate: what it belongs to, where it lives, how it was keyed, how long it should live, and how it can be invalidated without reaching for a whole-store flush.

Laravel already gives you excellent cache primitives. Cachelet turns those primitives into an inspectable operating model across app-level values, Eloquent models, query results, route responses, and optional telemetry exports.

```
use Oxhq\Cachelet\Facades\Cachelet;

$users = Cachelet::for('users.index')
    ->from(['page' => 1, 'role' => 'admin'])
    ->onStore('redis')
    ->ttl('+15 minutes')
    ->remember(fn () => User::query()->where('role', 'admin')->paginate());
```

Why Cachelet
------------

[](#why-cachelet)

Production cache bugs are rarely about calling `remember()` wrong. They are about invisible state:

- Which cache family owns this key?
- Which store was used?
- Which request, model, query, or service produced it?
- What is safe to invalidate?
- Did the fresh path recover after the intervention?

Cachelet makes those answers first-class.

What You Get
------------

[](#what-you-get)

- **Deterministic coordinates** for core, model, query, and request caches.
- **Stable key generation** from normalized payloads.
- **TTL and stale-while-revalidate** with lock-aware refresh behavior.
- **Scoped invalidation** by key, prefix, tag, or explicit scope.
- **Local inspection commands** for listing, inspecting, flushing, and pruning cache families.
- **Canonical telemetry** through `cachelet.telemetry.v1`.
- **Optional exporter support** when cache visibility needs to feed dashboards, audit trails, or developer tooling.

Cachelet is useful without an external service. The exporter is a tooling bridge for teams that want canonical cache evidence outside the Laravel process.

Install
-------

[](#install)

Most teams should start with the full suite:

```
composer require oxhq/cachelet
```

Use focused packages when a project only needs one layer:

PackageUse it for`oxhq/cachelet`Full suite: core + model + query + request + exporter`oxhq/cachelet-core`Generic builders, keys, TTL/SWR, invalidation, inspection, telemetry`oxhq/cachelet-model`Eloquent model caching, payload shaping, observer invalidation`oxhq/cachelet-query`Query builder and Eloquent result caching`oxhq/cachelet-request`Request/response caching middleware and route integration`oxhq/cachelet-exporter`Optional telemetry export for external toolingSee the full install guide: [`docs/install-matrix.md`](docs/install-matrix.md).

Quick Tour
----------

[](#quick-tour)

### Core Values

[](#core-values)

```
$report = Cachelet::for('reports.sales')
    ->from(['from' => '2026-01-01', 'to' => '2026-01-31'])
    ->ttl(1800)
    ->remember(fn () => $service->salesReport());
```

### Eloquent Models

[](#eloquent-models)

```
use Oxhq\Cachelet\Traits\UsesCachelet;

class User extends Model
{
    use UsesCachelet;
}

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

### Queries

[](#queries)

```
$admins = User::query()
    ->where('role', 'admin')
    ->cachelet()
    ->ttl(300)
    ->rememberQuery();
```

### Route Responses

[](#route-responses)

```
Route::get('/users', UserIndexController::class)
    ->name('users.index')
    ->cachelet(600, [
        'vary' => [
            'query' => true,
            'headers' => ['X-Tenant'],
            'auth' => true,
        ],
        'namespace' => 'users',
    ]);
```

More examples live in [`examples/`](examples).

Operator Commands
-----------------

[](#operator-commands)

Cachelet keeps enough sidecar state to make cache families visible from the CLI:

```
php artisan cachelet:list users.index
php artisan cachelet:inspect users.index
php artisan cachelet:flush users.index
php artisan cachelet:prune
```

The operator guide explains what each answer means: [`docs/operator-questions.md`](docs/operator-questions.md).

The Contract
------------

[](#the-contract)

Every coordinate resolves to `cachelet.coordinate.v1` with:

- `module`: `core`, `model`, `query`, or `request`
- `prefix`
- `key`
- `ttl`
- `version`
- `store`
- `tags`
- `swr`
- `metadata`

When observability events are enabled, Cachelet emits `CacheletTelemetryRecorded` records using `cachelet.telemetry.v1`.

See [`docs/operations.md`](docs/operations.md) for the full runtime contract.

When To Use Cachelet
--------------------

[](#when-to-use-cachelet)

Use raw Laravel cache calls when the cache is simple, local, and obvious.

Use a narrow point solution when the app only needs one specialized job, such as response caching.

Use Cachelet when a Laravel app has more than one cache surface and the team needs one vocabulary for keys, scopes, stores, invalidation, inspection, and telemetry.

Comparison guide: [`docs/comparison.md`](docs/comparison.md).

Docs
----

[](#docs)

- Start here: [`docs/README.md`](docs/README.md)
- Install matrix: [`docs/install-matrix.md`](docs/install-matrix.md)
- Migration guide: [`docs/migration.md`](docs/migration.md)
- Operations contract: [`docs/operations.md`](docs/operations.md)
- Operator questions: [`docs/operator-questions.md`](docs/operator-questions.md)
- Benchmarks: [`docs/benchmarks.md`](docs/benchmarks.md)
- Releases and publishing: [`docs/releases.md`](docs/releases.md)

Support Matrix
--------------

[](#support-matrix)

- Laravel `12.x` and `13.x`
- PHP `8.2`, `8.3`, `8.4`, and `8.5`
- CI covers Redis plus PostgreSQL-backed cache integration paths

Stability
---------

[](#stability)

`0.2.x` is intended to be production-usable. The package family is still early, so focused API tightening may happen before `1.0` if real usage proves a better contract.

Cachelet does not claim automatic relational invalidation for arbitrary query graphs, CDN orchestration, Blade fragment caching, or perfect zero-config inference for every cache use case.

Community
---------

[](#community)

- Contributing: [`CONTRIBUTING.md`](CONTRIBUTING.md)
- Security reports: [`SECURITY.md`](SECURITY.md)
- Support policy: [`SUPPORT.md`](SUPPORT.md)
- Code of conduct: [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md)

Repository
----------

[](#repository)

This monorepo is the public source of truth for `oxhq/cachelet` and the focused split packages. Maintainer workflow details live in [`CONTRIBUTING.md`](CONTRIBUTING.md), [`docs/monorepo.md`](docs/monorepo.md), and [`docs/releases.md`](docs/releases.md).

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance90

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~4 days

Total

6

Last Release

71d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a1e66a354a710e1b8f3254cb843ed74159bb261809a3deaccfff898bfcbdee7a?d=identicon)[garaekz](/maintainers/garaekz)

---

Top Contributors

[![garaekz](https://avatars.githubusercontent.com/u/14919842?v=4)](https://github.com/garaekz "garaekz (8 commits)")

---

Tags

laravelcacheswrinvalidationQuery Cacheresponse-cache

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/oxhq-cachelet/health.svg)

```
[![Health](https://phpackages.com/badges/oxhq-cachelet/health.svg)](https://phpackages.com/packages/oxhq-cachelet)
```

###  Alternatives

[awssat/laravel-visits

Laravel Redis visits counter for Eloquent models

973172.3k2](/packages/awssat-laravel-visits)[swayok/alternative-laravel-cache

Replacements for Laravel's redis and file cache stores that properly implement tagging idea. Powered by cache pool implementations provided by http://www.php-cache.com/

202583.7k8](/packages/swayok-alternative-laravel-cache)[dragon-code/laravel-cache

An improved interface for working with cache

7046.0k10](/packages/dragon-code-laravel-cache)[henzeb/laravel-cache-index

Flexible replacement for tags

1216.1k](/packages/henzeb-laravel-cache-index)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
