Best way to save redis keys

I use Redis to store some information and detect changes in this information over time (for example, I think users and locations). What is the value of using a longer or shorter name? Using a longer key is clearer, but is there any greater cost for memory or performance when using a longer key?

Here are some examples:

SET L:123456 "<name> <latitude> <longitude> ..."
HSET U:987654321 loc 123456 time <epoch>

or

SET loc:{123456} "<name> <latitude> <longitude> ..."
HSET user:{U987654321} loc 123456 time <epoch>
0
source share
2 answers

, . , , kB, , . ; " ". redis, . Redis .

HSET , , . : HSET user:data 987654321 '{"loc": "123456", "time": "2014-01-01T13:00:00"}'. / "" , , - . , .

: .

: , , . redis Sorted Set, "" ( "" "" ). "", float64, -999999999999999 999999999999999, (15 ), - . , Redis O (log (n)) ( , ).

: MsgPack () , . JSON , , , IPC, . , , (), , . Redis. . , . Lua ( ), . JSON MsgPack , " ". . (, HSET), ( : ). . : , MsgPack.

: HSET ZSET, , , PascalCased 10-25 , ':', ( ), JSON ( , MsgPack) Lua ( Lua, , Redis, ).

, A/B, , .

, , TW

+3
0

Source: https://habr.com/ru/post/1540195/


All Articles