-
Notifications
You must be signed in to change notification settings - Fork 5
Redis (Basics)
Gaurav Chandak edited this page Jul 23, 2016
·
1 revision
#Redis (Basics)
Redis is an open source, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets. Redis is written in C.
Redis has three main peculiarities that set it apart from much of its competition:
- Redis holds its database entirely in memory, using the disk only for persistence.
- Redis has a relatively rich set of data types when compared to many keyvalue data stores.
- Redis can replicate data to any number of slaves.
Redis transactions allow the execution of a group of commands in a single step. Transactions has two properties in it, which are described below:
- All commands in a transaction are sequentially executed as a single isolated operation. It is not possible that a request issued by another client is served in the middle of the execution of a Redis transaction.
- Redis transaction is also atomic. Atomic means either all of the commands or none are processed.
Partitioning is the process of splitting your data into multiple Redis instances, so that every instance will only contain a subset of your keys.
set name gauravget namemset tmp abc tmp1 bcdmget tmp tmp1del nameexists namekeys *keys *nameexpire name 2ttl namestrlen nameincr numappend name chandakhset gc name gauravhget gc namehmset gc name gaurav surname chandakhgetall gchkeys gchvals gchlen gchexists gc namelpush list1 gauravrpush list1 chandaklrange list1 2 10llen list1lpop list1rpop list1lindex list1 1lrem list1 -2 "gaurav"sadd tutorials redis mongodb mongodbsmembers tutorialssismember tutorials redisscard tutorialssinter tutorials tutorials1spop tutorialssrem tutorials mongodbzadd tutorials 1 redis 2 mongodb 3 mongodbzrange tutorials 0 10 withscoreszrangebyscore tutorials 0 100pfadd tutorials "redis" tutorials "mongodb"pfcount tutorialssubscribe redischatpublish redischat "redis is a great caching technique"