When to use Enforce uniqueness of elements Creating relationship between other entity Common elements between other entity Guarantee operation idempotence Order of elements d...
Which data is to be cached
Consideration design on redis What data should be fetched Data structure Often accessed and common data among users This is common strategy when choosing cache data. Not often changed dat...
Serialize and Deserialize
Requirements We have to provide serialize and deserialize in redis hash. Because, serialize doesn’t require id in values. And it’s not appropriate storing specific format and data in redis because...
Tips about Hash commands
When to use hash? Store key - value entity. It’s similar row in traditional database Reasons to use hashes The row has many attributes A collection of records have to be sorted many differen...
Redis multi key and range operation
Multi key operation MSET Set multi key - value pairs redis-cli> MSET key1 value1 key2 value2 MGET Get multi values from multi keys order by key redis-cli> MGET key1 key2 redis-cli> [v...
Redis Overview
Why use redis Faster than other DB REDIS is abbreviation of REmote DICtionary Server Simple and organized data structure Redis support strings, hashes, set, sorted set, list Simple feature...
Locking
Exclusive Lock Usually, write. It’s like a mutex lock Lifetime In a single transaction Only one transaction can get exclusive lock. Shared Lock Usually, read. Lifetime In multiple transactions ...