Expire problems in the old version of Redis and the installation test of the new version

Source: Internet
Author: User
Tags redis redis version

Today we found that a value in the Redis database is always 1, but it does incr n many times for this value in the program

After each incr, set a expire time, try to expire this sentence after the note, this value has been growing

Isn't it expire wrong. Looked up the official document of Redis, yes, so I tested it myself.


debian:~$ redis-cli
redis> incr dd
(integer) 1
redis> incr dd
(integer) 2
redis> incr dd< c5/> (integer) 3
redis> incrby dd
(integer)
redis> expire dd
(integer) 1
redis> Get DD
redis> incr dd
(integer) 1

Originally in expire, then INCR will start again from 1, no wonder I that value is always, this is obviously a bug.

First look at the Redis version with dpkg.

debian:~$ dpkg-l redis-server
desired=unknown/install/remove/purge/hold
| Status=not/inst/conf-files/unpacked/half-conf/half-inst/trig-await/trig-pend
|/Err?= (none)/Reinst-required (Status,err:uppercase=bad)
| | /Name                         Version                      Description
+++-============================-============================-========== ==============================================================
II  redis-server                 2:1.2.6-1                    Persistent Key-value database with network interface

The original is 1.2.6, now the latest Redis are 2.4.4 AH. The software version on Debian is old enough. My Debian is the newest Debian 6.

So I downloaded the Redis code, after compiling, with a new version of the test

1. Download decompression

wget http://redis.googlecode.com/files/redis-2.4.4.tar.gz
tar-zxf redis-2.4.4.tar.gz

2. Compile

CD redis-2.4.4 make

3. Run

Change the redis.conf first, change the daemonize to Yes, change the port to 6378, and start the Redis

./src/redis-server redis.conf

4. Test,

It's the same as in the old version, but the results are correct. Expire after incr, not starting from 1.

debian:~/software/redis-2.4.4$ redis-cli-p 6378
redis> incr dd
(integer) 1
redis> incr DD
( Integer) 2
redis> incr dd
(integer) 3
redis> incrby dd
(integer)
redis> expire DD 600< c10/> (integer) 1
redis> get dd
redis> incr dd
(integer) 54


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.