Redis is an open-source key value storage that can operate as both an in-memory store and as cache. Redis server can be used to cache the database resulting in exploitation of less database resources, and provides a tunable persistent cache.
When first time page is loaded, a database is queried on the server. Redis caches the query. Next time other user loads the page the results are provided from the redis without querying the actual database. Redis implements a persistent object cache (no expiration). An object cache works by caching the SQL queries in memory which are needed to load the web page. When the data of main database server is updated,then corresponding key in th redis is invalidated. So the redis provides the updated data instead of caching the data. If a query is not available in Redis, the database provides the result and Redis adds the result to its cache.
Implementation of redis-server decreases the load on database. With Redis as a cache, you gain a lot of power (such as the ability to fine-tune cache contents and durability) and overall greater efficiency. It gives much greater flexibility regarding the objects you can cache.