Reputation: 107
I want to implement Cache system but i found tutorials where they use Cache facade but when i open Redis documentation they use Redis facade, is there difference or that is same thing?
Upvotes: 1
Views: 1694
Reputation: 9868
The Cache
facade lets you access the cache, so you can add/get/forget cache items. If you use redis as your cache driver this will use your redis instance as the cache store.
The Redis
facade lets you access a redis connection, not the cache, although these may actually be the same redis instance depending on your config. This lets you access the pub/sub features of redis and interact with the redis instance using redis commands https://redis.io/commands
To get a better look at what the facades can do you can look at the classes they resolve to. The Cache facade resolves to Illuminate\Contracts\Cache\Repository
and the Redis facade to Illuminate\Redis\Connections\Connection
.
More info on what classes the facades resolve to at https://laravel.com/docs/6.x/facades#facade-class-reference
Upvotes: 2