What is Redis and how is it used in PHP?
Why Interviewers Ask This
This question targets practical, hands-on experience with PHP. Interviewers want to see if you've worked with these concepts in real projects, not just read about them. Strong answers include concrete examples.
Answer
Redis is an in-memory data structure store used as a cache, message broker, and session store. In PHP applications, it is commonly used for: caching (storing frequently accessed database results), session storage (faster and more scalable than file-based sessions), queue backends (Laravel queues with the Redis driver), rate limiting, and pub/sub messaging. Connect using the predis/predis Composer package or the phpredis C extension (faster). In Laravel, configure Redis in config/database.php and use it with Cache::remember(), Session::driver("redis"), or the Queue system. Redis is significantly faster than database-based caching because all data lives in RAM.
Pro Tip
If you're unsure about a detail, say so honestly and explain your reasoning. Interviewers respect candidates who can think through uncertainty rather than bluffing.
Previous
What is a Service Container (IoC Container) in PHP?
Next
What is PHP's arrow function and how does it differ from a closure?