Storing and retrieving data with Redis
Redis is a non-traditional database, dubbed a data structures server, which functions in operational memory with blazingly fast performance.
Redis is excellent for certain tasks, as long as the data model is fairly simple and isn't so large that it swamps your server RAM. Good examples of where Redis shines are in site analytics, server-side session cookies, and providing a list of logged-in users in real time.
In the spirit of our theme, we will re-implement our quotes database with Redis.
Getting ready
We'll be using the node_redis
client.
npm install redis
We also need to install the Redis server, which can be downloaded from http://www.redis.io/download along with installation instructions.
Let's also create ...
Get Node Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.