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

Zend Cache Laravel Package

zendframework/zend-cache

zendframework/zend-cache provides flexible caching for PHP apps with multiple storage backends (filesystem, memory, APCu, Redis, and more). Supports cache patterns, plugins, serialization, and configurable adapters to improve performance and reduce repeated work.

View on GitHub
Deep Wiki
Context7

CallbackCache

The callback cache pattern caches the results of arbitrary PHP callables.

Quick Start

use Zend\Cache\PatternFactory;
use Zend\Cache\Pattern\PatternOptions;

// Via the factory:
$callbackCache = PatternFactory::factory('callback', [
    'storage'      => 'apc',
    'cache_output' => true,
]);

// Or the equivalent manual instantiation:
$callbackCache = new \Zend\Cache\Pattern\CallbackCache();
$callbackCache->setOptions(new PatternOptions([
    'storage'      => 'apc',
    'cache_output' => true,
]));

Configuration Options

Option Data Type Default Value Description
storage `string array Zend\Cache\Storage\StorageInterface`
cache_output boolean true Whether or not to cache callback output.

Available Methods

In addition to the methods defined in the PatternInterface, this implementation provides the following methods.

namespace Zend\Cache\Pattern;

use Zend\Cache\Exception;
use Zend\Stdlib\ErrorHandler;

class CallbackCache extends AbstractPattern
{
    /**
     * Call the specified callback or get the result from cache
     *
     * [@param](https://github.com/param)  callable   $callback  A valid callback
     * [@param](https://github.com/param)  array      $args      Callback arguments
     * [@return](https://github.com/return) mixed Result
     * [@throws](https://github.com/throws) Exception\RuntimeException if invalid cached data
     * [@throws](https://github.com/throws) \Exception
     */
    public function call($callback, array $args = []);

    /**
     * Intercept method overloading; proxies to call()
     *
     * [@param](https://github.com/param)  string $function  Function name to call
     * [@param](https://github.com/param)  array  $args      Function arguments
     * [@return](https://github.com/return) mixed
     * [@throws](https://github.com/throws) Exception\RuntimeException
     * [@throws](https://github.com/throws) \Exception
     */
    public function __call($function, array $args);

    /**
     * Generate a unique key in base of a key representing the callback part
     * and a key representing the arguments part.
     *
     * [@param](https://github.com/param)  callable   $callback  A valid callback
     * [@param](https://github.com/param)  array      $args      Callback arguments
     * [@return](https://github.com/return) string
     * [@throws](https://github.com/throws) Exception\RuntimeException
     * [@throws](https://github.com/throws) Exception\InvalidArgumentException
     */
    public function generateKey($callback, array $args = []);
}

Examples

Instantiating the Callback Cache Pattern

use Zend\Cache\PatternFactory;

$callbackCache = PatternFactory::factory('callback', [
    'storage' => 'apc'
]);
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport