tips:db:redis

This is an old revision of the document!


redis

type hash for tables and rows

namespace:table:id

INCR gianoauth:realm:next_user_id => 1
HSET gianoauth:realm:user:1 id 1 username "scipio" name "Stefano Scipioni" password "hash"

add an INDEX with sets: collections of strings that are unordered and cannot contain duplicates

SADD gianoauth:realm:all-users gianoauth:realms:users:1

use multi exec to surround HSET and SADD

MULTI
HSET ...
HSET ...
SADD ...
EXEC

sorted set: like a set a sorted set only allows members without repeats, but also allows you to specify a score

ZADD gianoauth:realms:priceIndex 10.99 scipio
sudo apt install -y redis-server redis-tools
  • tips/db/redis.1509993553.txt.gz
  • Last modified: 2017/11/06 19:39
  • by scipio