Skip to content

v1.46.0 — Gienah: Fluent Query Caching

Choose a tag to compare

@MichaelSowah MichaelSowah released this 28 May 02:46
· 180 commits to main since this release
c103669

Theme: Fluent Query Caching. QueryBuilder::cache(ttl, tags) is now actually wired through to QueryCacheService — the
method was previously a silent no-op. Also marks the start of the framework-wide PHPStan level-8 hardening initiative.

Highlights

Fluent query result caching — ->cache(ttl, tags)

QueryBuilder::cache(?int $ttl = null, array $tags = []) now caches read queries (get / first / count / max) through
QueryCacheService. Cache entries are automatically tagged by the involved tables plus any caller-supplied $tags, so they
can be invalidated targetedly:

User::query()
    ->where('status', 'active')
    ->cache(ttl: 3600, tags: ['users'])
    ->get();
    
// Later, on a write:
$cache->invalidateTags(['users']);   // your tag
// or
$cache->invalidateTags(['query_cache:table:users']);   // automatic per-table tag

Per-query (no global toggle required); the executor lazily resolves a cache backend and degrades to uncached execution if none is
configured. Backward compatible — everything else is unchanged.

Closed: ->cache() was a silent no-op

The fluent cache() method existed before this release but set builder-local flags that get() never propagated to the executor — so
the TTL was ignored and there was no tags parameter. The advertised behavior didn't match the code; that gap is now closed.

PHPStan level-8 hardening — initiative kickoff

The framework's eventual goal is to run PHPStan level 8 across all of src/ and enforce it in CI. The CI gate today remains level 6
(green); this release lands the first slice (two binding-path typing fixes — behavior-preserving) and catalogues the full
~914-error level-8 gap by area, with risk notes and an incremental adoption strategy, in docs/LEVEL8_TYPING_DEBT.md
(https://github.com/glueful/framework/blob/v1.46.0/docs/LEVEL8_TYPING_DEBT.md).

Upgrade Notes

- No action required. Framework-only release — no migrations, no env vars.
- ->cache() semantics changed from "no-op" to "actually caches". Any app code calling ->cache(ttl) and expecting nothing to happen
will now cache. The cache key is query+params (no auth/context scoping), so make sure cached queries don't return user-scoped rows
without a discriminator in the SQL.
- api-skeleton 1.29.0 is the paired release (bumps the framework constraint).

composer update glueful/framework

Full changelog: https://github.com/glueful/framework/compare/v1.45.0...v1.46.0
Release notes (curated): https://docs.glueful.com/releases#v1-46-0-gienah