Related redis underlying command (a)

Explanation

For analyzing the underlying data structures and memory redis case

 

Underlying data structure analysis

1. Review the key object type key type key

Local: 0 > test1 Sadd . 1  2  . 3   . 4  . 5 
. 5 

Local: 0 > type test1
 SET

2. Check the key corresponding to the key data structure of object types redi

test1 Sadd . 1  2  . 3   . 4  . 5 
. 5 
Local: 0 > CT encoding test1 
IntSet 

local: 0 > Sadd test1 F
 0 

Local: 0 > Object encoding test1 
Hashtable

3. Check the corresponding key reference count value (rather than duplicating shared created)

1919alitest:0>set test2 687199539746074624
OK

1919alitest:0>set test3 687199539746074624
OK

1919alitest:0>object refcount test2
1

Redis creates a string object should 0-9999 default then all local re-use of this range will be shared object are redis will only set the share value of type String objects

3. Check the access time of the last key (s)

1919alitest:0>object idletime test2
6117

With the current time minus the value of the object lru time

If the server is turned on and will maxmemory memory recall settings for as long as volatile-lru did not visit the first being recovered

 

Guess you like

Origin www.cnblogs.com/LQBlog/p/11798953.html