ez-php/cache

Cache module for the ez-php framework — array, file, and Redis drivers with a unified interface

Maintainers

Package info

github.com/ez-php/cache

pkg:composer/ez-php/cache

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.2.0 2026-03-15 03:47 UTC

This package is auto-updated.

Last update: 2026-03-15 04:17:53 UTC


README

Cache module for the ez-php framework — array, file, and Redis drivers with a unified interface.

CI

Requirements

  • PHP 8.5+
  • ez-php/framework ^1.0
  • ext-redis (for Redis driver)

Installation

composer require ez-php/cache

Setup

Register the service provider:

$app->register(\EzPhp\Cache\CacheServiceProvider::class);

Configure the driver in config/cache.php:

return [
    'driver' => env('CACHE_DRIVER', 'array'), // array | file | redis
    'path'   => storage_path('cache'),
    'redis'  => [
        'host' => env('REDIS_HOST', '127.0.0.1'),
        'port' => (int) env('REDIS_PORT', 6379),
    ],
];

Usage

$cache = $app->make(\EzPhp\Cache\CacheInterface::class);

$cache->put('key', 'value', ttl: 3600);
$value = $cache->get('key');
$cache->forget('key');

License

MIT — Andreas Uretschnig