The Big, the Small and the Redis
Андрей Савченко
Доклад посвящен Redis: одной из самых недооценённых СУБД. Имея, на первый взгляд, не очень большой функционал, при пристальном рассмотрении Redis может дать фору большинству более жирных конкурентов. О том, как правильно его “готовить”, где применять на практике и как вовремя остановиться и будет идти речь в докладе.
32. Simple graphs
# User Joe adds user Mila to friends
SADD users:{joe}:friends {mila}
SADD users:{mila}:friend_of {joe}
!
# Get Mila's friends
SMEMBERS users:{mila}:friends
!
# Get user Mila's mutual friends
SCARD users:{mila}:friends users:{mila}:friend_of
!
# Get common friends of Mila and Joe
SCARD users:{mila}:friends users:{joe}:friends
!
# Joe is a friend of user Mila?
SISMEMBER users:{mila}:friends {joe}
33. Message bus
# Web-application:
SUBSCRIBE messages
!
# Async jobs server:
SUBSCRIBE jobs
!
# Web-application:
PUBLISH jobs "videos:12:mpeg:ogg"
!
# Async jobs server:
PUBLISH messages "Video encoding #12 finished"