digitalnatives / craft3-illuminate-redis-adapter
Redis Cache based on Illuminate redis for CraftCMS 3|4
Installs: 4 491
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: >=8.2.0
- craftcms/cms: ^3.0 | ^4.0 | ^5.0
- illuminate/cache: ^8.0 | ^9.0 | ^10 | ^11
- illuminate/redis: ^8.0 | ^9.0 | ^10 | ^11
Requires (Dev)
- ext-redis: ^4.0 | ^5.0 | ^6.0
- phpstan/phpstan: ^1.6
- predis/predis: ^1.1.9 | ^2.0
Suggests
- ext-redis: Required to use the phpredis connector (^4.0|^5.0|^6.0).
- predis/predis: Required to use the predis connector (^1.1.9 || ^2.0)
This package is auto-updated.
Last update: 2024-11-04 14:20:37 UTC
README
Redis Cache based on Illuminate redis for CraftCMS 3
Installation
You can install this package using composer;
composer require digitalnatives/craft3-illuminate-redis-adapter
Choose an adapter
PHPredis (recommended)
For best performance we recommend using ext-phpredis
Config
return [ 'components' => [ 'cache' => [ 'class' => DigitalNatives\Cache\Redis::class, 'defaultDuration' => 86400, 'connection' => 'phpredis', 'config' => [ 'host' => getenv('REDIS_HOST'), 'port' => (int)getenv('REDIS_PORT'), 'database' => getenv('REDIS_DB'), 'connectTimeout' => 60, 'readTimeout' => 60, 'serializer' => \Redis::SERIALIZER_NONE ], ], ], ];
predis
When installing php extensions is not an option, predis is a very good option.
If you haven't installed predis, install it using composer;
composer require predis/predis
Config
return [ 'components' => [ 'cache' => [ 'class' => DigitalNatives\Cache\Redis::class, 'defaultDuration' => 86400, 'connection' => 'predis', 'params' => [ 'host' => getenv('REDIS_HOST'), 'port' => (int)getenv('REDIS_PORT'), ], 'options' => [ ['profile' => '5.0'] ] ], ], ];