damalis / redis-cache-for-php-framework
Redis cache for php framework
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/damalis/redis-cache-for-php-framework
Requires
- php: ^7.4 || ^8.0
- predis/predis: >=2.0
This package is auto-updated.
Last update: 2025-09-15 11:39:35 UTC
README
Redis cache for php framework.
Installation
composer require damalis/redis-cache-for-php-framework
Usage
Cache every successful HTTP response for 24 hours in the local Redis server.
Example:
slim framework;
use Slim\Factory\AppFactory;
use Slim\Factory\ServerRequestCreatorFactory;
require __DIR__ . '/../vendor/autoload.php';
$app = AppFactory::create();
//...
// Create Request object from globals
$serverRequestCreator = ServerRequestCreatorFactory::create();
$request = $serverRequestCreator->createServerRequestFromGlobals();
$client = new \Predis\Client('tcp://localhost:6379', [
'prefix' => $request->getUri()->getHost()
]);
$app->add(new \damalis\RedisCache\Cache($client, [
'timeout' => 86400
]));
// ...