You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Once the redis service configured, we can access redis server through app()->redis in our application. As
the Redis component is based on Predis, you can refer their documentation on
how to issue command to redis servers.
Using redis as a cache service
The component provides a PSR-16 SampleCache implementation which using redis as a cache storage. We can define
a cache service in services.php likes the folowing:
'cache' => [
'class' => blink\redis\cache\SampleCache::class,
'redis' => 'redis', // The redis service to store cached data'prefix' => '', // The prefix of cached key
]
Once the cache service configured, we can access the cache service through app()->cache in our application.
Using redis as session storage
The component also provides a Session Storgae class which allows Blink to store application sessions into redis.
we can configure the session storage in the following way:
'session' => [
'class' => blink\session\Manager::class,
'expires' => 3600 * 24 * 15,
'storage' => [
'class' => blink\redis\session\Storage::class,
'redis' => 'redis', // the redis service to store sessions
]
],