10. STRING
Simple string or integer values
GET Fetch the data stored at the given key
SET Set the value stored at the given key
DELETE Delete the value stored at the given key (works for all types)
ex.
SET users:anto "{'name': 'antonio', 'email':'anto80@gmail.com'}"
12. HASH
Unordered mapping of keys to values of strings or integer values
HSET Stores the value at the key in the hash
HGET Fetches the value at the given hash key
HGETALL Fetches the entire hash
HDEL Removes a key from the hash, if it exists
ex.
HSET users:1032 email anto80@gmail.com
HSET users:searching anto80@gmail.com 1032
14. LIST
Ordered sequence of strings
RPUSH Push the value onto the right end of the list
LRANGE Fetch a range of values from the list
LINDEX Fetch an item at a given position in the list
LPOP Pop the value from the left end of the list and return it
ex.
RPUSH zend:queue:log {'userId':12332,'UA':Opera/9.0 (Window....; en)'}
16. SET
Unordered bag of unique strings
SADD Add the item to the set
SMEMBERS Return the entire set of items
SISMEMBER Check if an item is in the set
SREM Remove the item from the set, if it exists
ex.
SADD mycompany:myteam antonio giulio walter gianluca
18. SORTED SET (ZSET)
Ordered mapping of string members to floating point scores, ordered by score
ZADD Add member with the given score to the ZSET
ZRANGE Fetch the items in the ZSET from their positions in sorted order
ZRANGEBYSCORE Fetch items in the ZSET based on a range of
scores
ZREM Remove the item from the ZSET, if it exists
ex.
ZADD game:users:1132 maxscore 2342
19. Redis to go?
PhpRedis : https://github.com/nicolasff/phpredis
<?php
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);