cache/namespaced-cache
A PSR-6 decorator that scopes a shared cache pool to a single namespace, so clear() invalidates only that namespace. Includes tag support, generation-key safety, and | hierarchical key deletion.
"user:{$id}:profile") versus a consistent, enforced namespace convention (tenant:{id}:module:{name}). Even if you don't adopt the library, this is the decision to make — cache-key collisions and cross-tenant leakage are product-risk issues (data exposure, incorrect feature flags, stale pricing), not just engineering hygiene.Psr\Cache\CacheItemPoolInterface (~one class, prefixing keys). The honest comparison is: one Composer dependency with 14 stars, 0 dependents, and a read-only split repo vs. ~30 lines of in-house decorator you fully control. Take the dependency only if you're already standardized on the php-cache PSR-6 stack.SCAN-and-pray script. Verify namespace-scoped flush behavior in a spike before you promise it to stakeholders.get/put. That's a genuine roadmap lever if you have a large legacy cache surface and no appetite for a cache refactor this quarter.CacheStore/CacheManager and PSR-16 (Psr\SimpleCache), not PSR-6. There is no service provider, no config/cache.php driver, no Cache::namespace() method, and no facade integration in this package. Do not let a roadmap item ("adopt namespaced cache in Laravel") assume drop-in behavior — it would require a bridge (Laravel store → PSR-6 pool → NamespacedCachePool → PSR-16 adapter → back into Laravel), which is more machinery than the problem warrants.Adopt if:
php-cache family (cache/redis-adapter, cache/adapter-common, etc.) and want namespace scoping with a one-line decorator instead of touching every call site.Look elsewhere (or build the 30-line version) if:
prefix option on cache stores, separate stores per tenant in config/cache.php, and Cache::tags() on Redis/Memcached/DynamoDB/array for grouped invalidation. A small custom CacheStore decorator gives you the same ergonomics without the PSR-6 bridge.products" semantics.Minimum bar before adoption: a one-day spike proving (a) the bridge into your actual runtime works, (b) namespace-scoped flush behaves as expected, (c) measured overhead on your hot paths, and (d) a documented fallback if the package goes quiet.
For executives — one paragraph, framed as risk, not technology:
"We need a consistent way to keep one tenant's cached data from colliding with another's. This library solves that pattern, but it's a small utility with essentially no industry adoption (14 stars, zero dependent projects), so I don't recommend betting the platform on it. The recommended path is to adopt the pattern — a namespaced key convention enforced in one place — and implement it with either Laravel's built-in store prefixes and tags or a small internal decorator. Cost is roughly a day of engineering; the benefit is preventing cross-tenant data exposure and making per-tenant cache clearing a supported operation. If engineering already uses the php-cache PSR-6 stack, we can take the package as-is for near-zero effort; otherwise the internal version is the lower-risk call."
For engineering — direct and specific:
new NamespacedCachePool($hierarchyPool, 'acme') — a PSR-6 CacheItemPoolInterface decorator that prefixes keys with a namespace. That's it. The README is the entire documentation; there is no Laravel service provider, facade, config driver, or Cache::namespace() API.php-cache PSR-6 adapters. In Laravel, the equivalent is the store prefix, per-tenant stores, Cache::tags(), or a custom CacheStore decorator (~30 LOC).How can I help you explore Laravel packages today?