Git Product home page Git Product logo

laminas-cache-predis's Introduction

cytec/laminas-cache-predis

Redis adapter for Laminas framework with tagging support

Installation

composer require cytec/laminas-cache-predis

Configuration

Somewhere in your configuration (eg. config/autoload/global.php) add

...
'caches' => [
    'AppCache' => [
        'adapter' => 'Cytec\Cache\Storage\Adapter\Predis',
        'options' => [
            'ttl' => 600,
            'predis_client_connections' => [
                'host' => '127.0.0.1',
                'port' => 6379,
            ],
            'predis_client_options' => [
                'profile' => '2.4',
                'prefix'  => 'ns:'
            ]
        ],
        'plugins' => [
            ['name' => 'serializer']
        ],
    ]
],
...

Since laminas-cache v3 storage adapters need to be registered as modules:

modules.config.php:

<?php

return [
    ...{your other modules}...
    'Cytec\Cache\Storage\Adapter\Predis',
];

The predis_client_connections option is passed directly as the first argument when creating the Predis client and predis_client_options as the second parameter:

$client = new Predis\Client($predis_client_connections, $predis_client_options);

For more information check out Predis documentation on Connection Parameters and Client Options

And then you can get the cache via the service manager:

$cache = $this->getServiceManager()->get('AppCache');
$cache->setItem($key, $value);

laminas-cache-predis's People

Contributors

peterprototypes avatar iganev avatar

Stargazers

Rudger avatar Jorge Cabral avatar

Watchers

James Cloos avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.