Slide 1

Slide 1 text

& by Antonio De Patto ... a redis fan

Slide 2

Slide 2 text

Which one

Slide 3

Slide 3 text

Salvatore Sanfilippo aka antirez

Slide 4

Slide 4 text

ALL data-set in RAM

Slide 5

Slide 5 text

PERSIST 1) Periodic snapshot 2) In Append 3) Delegate to slave

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

Very fast about 100.000 queries/second

Slide 8

Slide 8 text

5 different data structures ● STRING ● HASH ● LIST ● SETS ● SORTED SETS

Slide 9

Slide 9 text

STRING Simple string or integer values

Slide 10

Slide 10 text

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':'[email protected]'}"

Slide 11

Slide 11 text

HASH Unordered mapping of keys to values of strings or integer values

Slide 12

Slide 12 text

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 [email protected] HSET users:searching [email protected] 1032

Slide 13

Slide 13 text

LIST Ordered sequence of strings

Slide 14

Slide 14 text

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)'}

Slide 15

Slide 15 text

SET Unordered bag of unique strings

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

SORTED SET (ZSET) Ordered mapping of string members to floating point scores, ordered by score

Slide 18

Slide 18 text

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

Slide 19

Slide 19 text

Redis to go? connect('127.0.0.1', 6379); PhpRedis : https://github.com/nicolasff/phpredis

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

Sessions session.save_handler = redis session.save_path = "tcp://host1:6379?weight=1"

Slide 22

Slide 22 text

Cache

Slide 23

Slide 23 text

Queues BLPOP, BRPOP, RPOPLPUSH

Slide 24

Slide 24 text

PUB/SUB SUBSCRIBER SUBSCRIBER PUBLISHER PUBLISHER PUBLISHER PUBLISHER REDIS pub/sub

Slide 25

Slide 25 text

No content