The three main features that Redis inherits from its many competitions are:
The Redis database is completely in memory and uses disk for persistence only.
Redis has a rich set of data types compared to many key-value data stores.
Redis can replicate data to any number of slave servers.
Redis Benefits
Exceptionally fast: Redis is very fast and can perform about 110,000 episodes per second, about 81000 + records per second.
Support for rich data types: Redis support Most developers already know like lists, collections, ordered collections, hash data types. This makes it very easy to solve a wide variety of problems because we know which issues are better than the data types that can be handled through it.
Operations are atomic: All Redis operations are atomic, which ensures that Redis servers accessed by two clients at the same time will get the updated values.
Multifunction utility: Redis is a versatile tool that can be used in multiple uses such as cache, message, queue (Redis native support publish/subscribe), any transient data, applications such as Web application sessions, Web page hits count etc.
Redis-Environment
Install Redis on Ubuntu, open terminal, and type the following command:
$sudo apt-get Update $sudo apt-get Install Redis-server
This will install Redis on your computer.
Start Redis
$redis-server
Check to see if Redis is working?
$redis-CLI
This will open a redis hint, as shown in:
Redis 127.0.0.1:6379>
The above tip 127.0.0.1 is the IP address of this machine, and 6379 is the port that the Redis server is running on. Now enter the ping command as shown in.
redis 127.0.0.1:6379> Ping PONG
This means that you have successfully installed Redis on your machine.
Installing Redis Desktop Manager on Ubuntu
To install Redis Desktop Manager on Ubuntu, simply open the download package from Http://redisdesktop.com/download and install it.
Redis Desktop Manager gives you the user interface to manage Redis keys and data.
Redis-Data type
Redis supports 5 types of data types, which are described in the following ways:
String
A Redis string is a sequence of bytes. Redis strings are binary safe, which means they have a known length without any special characters terminating, so you can store anything, 512 megabytes for the upper limit.
Example
redis 127.0.0.1:6379> SET name "Yiibai" ok redis 127.0.0.1:6379> GET name " Yiibai "
Above is an example of Redis's set and get commands, a redis name called Yiibai used by a key stored in a Redis string value.
Hash
A Redis hash is a collection of key-value pairs. A Redis hash value is a mapping between a string field and a string value, so they are used to represent the object
Example
redis 127.0.0.1:6379> hmset user:1 username yiibai password Yiibai pointsOKredis 127.0.0.1:6379> hgetall user:11) "username" 2) "Yiibai" 3) "password" 4) "Yiibai" 5) "points" 6) "
In the example above, the hash data type is used to store the user's object that contains the user's basic information. Here the Hmset,hegtall user command user:1 is the key.
List
The Redis list is a simple list of strings, sorted in order of insertion. You can add elements to the head or tail of the Redis list.
Example
Redis 127.0.0.1:6379> lpush tutoriallist redis(integer) 1redis 127.0.0.1:6379> lpush tutoriallist MongoDB(integer) 2redis 127.0.0.1:6379> lpush tutoriallist rabitmq(integer) 3redis 127.0.0.1:6379> lrange tutoriallist 01) "RABITMQ" 2) "MongoDB" 3) "Redis"
The maximum length of the list is 232-1 elements (4294967295, which can hold more than 4 billion elements in each list).
Source: >
From for notes (Wiz)
Getting Started with Redis (advantages, environment, strings, hashes, lists)