https://github.com/damalis/redis-cache-for-php-framework
Redis cache for php framework
https://github.com/damalis/redis-cache-for-php-framework
cache fat-free-framework framework fuel fuelphp php redis slim-framework
Last synced: 10 months ago
JSON representation
Redis cache for php framework
- Host: GitHub
- URL: https://github.com/damalis/redis-cache-for-php-framework
- Owner: damalis
- License: apache-2.0
- Created: 2022-11-07T07:50:26.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-01T12:35:14.000Z (almost 3 years ago)
- Last Synced: 2025-01-22T01:22:36.511Z (12 months ago)
- Topics: cache, fat-free-framework, framework, fuel, fuelphp, php, redis, slim-framework
- Language: PHP
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RedisCache
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
]));
// ...
```