z0s/cache

Redis Cache

Maintainers

Details

gitlab.com/z0s/cache

Source

Issues

Installs: 10

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Forks: 0

Type:composer-package

1.0.2 2022-02-16 15:20 UTC

This package is not auto-updated.

Last update: 2024-05-09 23:17:03 UTC


README

Installation

You can include it in your project using: composer require z0s/cache

Requirements

  1. PHP8.0 or higher
  2. Redis
  3. ext-redis
  4. ext-igbinary

Usage


$connection = new \z0s\Cache\Connection([
    'host' => [
        'tcp://127.0.0.1'
    ],
    'options' => [
        //'replication' => 'sentinel',
        //'service' => 'z0s',
        //'autodiscovery' => true,
        //'cluster' => 'predis',
        'parameters' => [
            // 'password' => ''
        ]
    ]
);

$cache = new \z0s\Cache\Cache($connection);

// Add data
$cache->set('key', 'value', 3600);

// Get data
$cache->get('key');

// Delete
$cache->delete('key');