Weave Code
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

Laminas Cache Laravel Package

laminas/laminas-cache

Laminas Cache provides flexible caching for PHP apps with storage adapters (memory, filesystem, Redis, etc.), plugins, and cache patterns. Includes PSR-6/PSR-16 support, configuration options, and utilities for improving performance and reducing expensive operations.

View on GitHub
Deep Wiki
Context7

Introduction

Cache patterns are configurable objects that solve known performance bottlenecks. Each should be used only in the specific situations they are designed to address. For example, you can use the CallbackCache or ObjectCache patterns to cache method and function calls; to cache output generation, the OutputCache pattern could assist.

All cache patterns implement Laminas\Cache\Pattern\PatternInterface, and most extend the abstract class Laminas\Cache\Pattern\AbstractPattern, which provides common logic.

Configuration is provided via the Laminas\Cache\Pattern\PatternOptions class, which can be instantiated with an associative array of options passed to the constructor. To configure a pattern object, you can provide a Laminas\Cache\Pattern\PatternOptions instance to the setOptions() method, or provide your options (either as an associative array or PatternOptions instance) to the second argument of the factory.

It's also possible to use a single instance of Laminas\Cache\Pattern\PatternOptions and pass it to multiple pattern objects.

Quick Start

Pattern objects can be created by instantiating one of the Laminas\Cache\Pattern\*Cache classes.

Standard Storage Adapter for Documentation

A cache adapter needs a storage adapter. To be able to follow the examples in the documentation, the adapter for the filesystem or the BlackHole adapter can be used, for example.

$storage = new Laminas\Cache\Storage\Adapter\Filesystem();
// or
$storage = new Laminas\Cache\Storage\Adapter\BlackHole();
use Laminas\Cache\Pattern\CallbackCache;
use Laminas\Cache\Pattern\PatternOptions;

$callbackCache = new CallbackCache(
    $storage,
    new PatternOptions()
);

Available Methods

The following methods are implemented by every cache pattern. Please read documentation of specific patterns to get more information.

namespace Laminas\Cache\Pattern;

interface PatternInterface
{

    /**
     * Get all pattern options
     */
    public function getOptions(): PatternOptions;
}

There are cache patterns which depend on a storage. In this case, these adapters implement the StorageCapableInterface:

namespace Laminas\Cache\Pattern;

use Laminas\Cache\Storage\StorageInterface;

interface StorageCapableInterface extends PatternInterface
{
    public function getStorage(): ?StorageInterface;
}
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.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony