Redis cache and its some important commands

Redis is in-memory data structure store, used as database, cache replica cartier love bracelets and message broker. It stores data on disk and also hermes replica jewelry in memory. We can call it as permanent + memory storage. It supports data types like regular databases …

  • string
  • hash
  • list
  • set
  • sorted sets

It supports various queries and provides high availability via Redis Sentineland automatic partitioning with Redis Cluster. More ref can be found here – http://redis.io/

Installations

Download redis from redis.io or if you want old versions you can find it on google code – https://code.google.com/p/redis/downloads/list

$ wget http://download.redis.io/releases/redis-3.0.3.tar.gz
$ tar xzf redis-3.0.3.tar.gz
$ cd redis-3.0.3
$ make
$ sudo make install

# Start Redis
$ redis-server 

# Verify Redis server
$ redis-cli info

Commands for Get and Set

# String
$ redis-cli get keyname
$ redis-cli set keyname value

# All items from the List
$ redis-cli LRANGE keyname 0 -1
$ redis-cli RPUSH keyname value

# All items from the Set
$ redis-cli SMEMBERS 
$ redis-cli SADD keyname value  

# All items from the zset
$ redis-cli ZRANGE keyname 0 -1
$ redis-cli ZADD keyname fieldname value   

# All items from the Hash
$ redis-cli hgetAll keyname
$ redis-cli HSET keyname filed <a href="http://www.moggerhangerpark.com/ipg/cartier-love-bracelets-replica,83790225">cartier bracelets</a> value

# Get all the keys
$ redis-cli keys *

# Get type of a key
$ redis-cli type key

Categories: Linux, Other