Redis je in-memory data structure server.
Strings¶
SET user:1:name ‘Jan’ GET user:1:name INCR page:views SETEX session:abc 3600 ‘{…}’
Hashes¶
HSET user:1 name ‘Jan’ email ‘jan@ex.com’ HGETALL user:1
Lists¶
LPUSH queue:tasks ‘{…}’ RPOP queue:tasks
Sorted Sets¶
ZADD leaderboard 1000 ‘player1’ 950 ‘player2’ ZREVRANGE leaderboard 0 9 WITHSCORES
HyperLogLog¶
PFADD visitors ‘u1’ ‘u2’ ‘u3’ PFCOUNT visitors
Redis = mocné struktury¶
Strings=cache, Hashes=objekty, Lists=fronty, ZSets=leaderboardy.
rediscachedatové struktury