Redis Basic

Redis is an open source (BSD licensed), in-memory data structure store, used as database, cache and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs and geospatial indexes with radius queries.

redis

1 .Install

1
2
3
4
$ wget http://download.redis.io/releases/redis-3.2.2.tar.gz
$ tar xzf redis-3.2.2.tar.gz
$ cd redis-3.2.2
$ make

The binaries that are now compiled are available in the src directory. Run Redis with:

1
$ src/redis-server

You can interact with Redis using the built-in client:

1
2
3
4
5
$ src/redis-cli
redis> set foo bar
OK
redis> get foo
"bar"

2. Super basic Commands(redis is case-insensitive):

add new key

1
$ SET mykey "hello"

set expire time

1
expire mykey 20

show all keys:

1
$ key *

get key:

1
$ get keyName

clean DB:

1
$ flushdb

delete keys

1
del key1 key2 key3

determine if key exist

1
exists mykey

…………………………………………………………….

http://redis.io/commands#