Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Prefixed Cache Laravel Package

cache/prefixed-cache

Decorates any PSR-6 or PSR-16 cache so every key automatically carries a fixed prefix. PrefixedCachePool::create() also supports native tags, and prefixes are safely encoded before joining to keys.

View on GitHub
Deep Wiki
Context7

Prefixed cache decorators

Latest Stable Version Coverage Software License

This package adds a fixed prefix to keys sent to an existing PSR-6 or PSR-16 cache.

Unlike NamespacedCachePool, clearing a prefixed cache clears the entire underlying pool. Use the namespaced package when you need isolated clearing.

Installation

composer require cache/prefixed-cache:^2.0

Usage

use Cache\Adapter\PHPArray\ArrayCachePool;
use Cache\Prefixed\PrefixedCachePool;

$sharedPool = new ArrayCachePool();
$pool = PrefixedCachePool::create($sharedPool, 'billing.');

create() returns a taggable decorator when the wrapped PSR-6 pool supports native tags. Its cache items keep setTags(), and tag invalidation uses the wrapped pool.

The public constructor remains available. It always returns the basic PrefixedCachePool type, so use create() when you need tag support.

Use PrefixedSimpleCache to decorate a PSR-16 cache.

Prefixes are encoded before they are joined to public keys. The reversible _xHH_ format leaves ASCII letters, digits, _, and . unchanged. Every other byte is encoded, including each byte in non-ASCII text. A literal lowercase _x sequence is also encoded so it cannot look like an encoded byte.

Before upgrading to version 2 or rolling back from it, clear affected caches when a prefix contains bytes outside [A-Za-z0-9_.] or a lowercase _x sequence. Those prefixes use different storage keys in version 2.

Contributing

Send pull requests to the main repository. Report issues on the GitHub issue tracker.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels