Book Image

CoffeeScript Application Development Cookbook

By : Mike Hatfield
Book Image

CoffeeScript Application Development Cookbook

By: Mike Hatfield

Overview of this book

Table of Contents (18 chapters)
CoffeeScript Application Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Working with Redis


Redis is an open source key-value database that provides a high-performance cross-platform server to store your application's data.

Unlike Sqlite, Redis does not have a fixed schema and is therefore a schemaless data store. It allows us to store objects that can be referenced by a key value.

In this section, we will see how to use CoffeeScript to store, retrieve, and delete data with Redis.

Tip

You can find more information, including documentation and installation instructions at the official Redis website at http://redis.io/.

Once you have installed Redis, install the Redis NPM package. It will allow us to connect, store, and retrieve values. It can be installed using the following command:

npm install redis --save

Connecting to the Redis server

Redis runs as a service and the Redis NPM client connects to a running server.

How to do it...

To connect to a Redis service running on the local machine, perform the following steps:

  1. Require the Redit package:

    redis = require 'redis'
  2. Create...