Working with Redis

What is Redis?

Redis is an open source, BSD licensed, advanced key-value cache and store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets, sorted sets, bitmaps and hyperloglogs.

Download from http://redis.io/download and follow the installation instructions.

1. Start up the server

$ ./redis-server

                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 3.0.3 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 17983
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

17983:M 27 Aug 09:29:46.683 # Server started, Redis version 3.0.3
17983:M 27 Aug 09:29:46.683 * DB loaded from disk: 0.000 seconds
17983:M 27 Aug 09:29:46.683 * The server is now ready to accept connections on port 6379

2. Connect to the server using the commandline interface.

$ ./redis-cli
127.0.0.1:6379> set "HLR:34" "{bar:'rab', foo:'oof'}"
OK
127.0.0.1:6379> get "HLR:34"
"{bar:'rab', foo:'oof'}"

# To clear the database.
127.0.0.1:6379> flushdb
OK

# To quit.
127.0.0.1:6379> quit

Source:
redis.io

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: