redis実装区間クエリー
1417 ワード
###redis
: , ? `Sorted Sets` `zrangebyscore` 。
```
zadd myset 1011 v1_start
zadd myset 1015 v1_end
zadd myset 1018 v2_start
zadd myset 1023 v2_end
```
myset 4 , v1 1011-1015 , v2 1018-1023 。
:redis Sorted Sets score float , 。
1014 , zrangebyscore :
```
zrangebyscore myset 1014 +inf LIMIT 0 1
1)v1_end
```
v1_end 1014 1, myset score 1014 member, , 1016:
```
zrangebyscore myset 1014 +inf LIMIT 0 1
1)v2_start
```
v2_start 。
[ ][1]。
。
### hash field expire
redis , redis 。 Hash field value , 。
![][2]
### redis
redis , Sorted Sets ZINCRBY
```
zincrby myset 1 config_no
1)2
```
myset config_no score 1, key member :
```
zadd myset 1 config_no
1)1
```
[1]: http://manual.csser.com/redis/sorted_set/zrangebyscore.html
[2]: http://zhanjindong.info/wp-content/uploads/2014/02/11.png