Comments (4)
Hello!
this is the right behavior. Write operations against volatile keys (keys with an
expire value associated) remove the key before to perform the operation. To
check why
please read the manual for the EXPIRE command. It is explained in detail.
Original comment by [email protected]
on 29 Apr 2009 at 3:35
- Changed state: Invalid
from redis.
Hi,
I have read the behaviour of EXPIRE before, but as I see it now, I didn't go
into
details enough. I just didn't expect that INCRBY would act the way it did...
I wonder if this is the right way to do it... Maybe it would be better to get
an
error response instead of setting completly wrong value to the key?
Original comment by [email protected]
on 29 Apr 2009 at 4:44
from redis.
Hello Davor, unfortunately to return an error does not work in order to have a
time
independent data model: imagine the following:
{{{
PUSH foo 1
EXPIRE foo 1
... after some time ...
PUSH foo 2
}}}
The only way to ensure that the dataset will be the same both if the second
push is
performed 1 millisecond after or five seconds after is to consider the key
already
expired. This can appear an odd feature at first but I think in the long run it
will
pay to have a very stable replication that is not related to the time factor.
Original comment by [email protected]
on 29 Apr 2009 at 4:56
from redis.
Hello Antirez,
I've solved my problem with INCR & EXPIRE, by not using INCR at all:
{{{
SET a 5
EXPIRE a 60
...
GET a
5
SET a 5+5
EXPIRE a 60
...
}}}
... it's not a very elegant solution, but it does the trick.
I've been thinking a bit more about this issue... The INCR is an operation on
existing key, but it also creates new key with default value 0 and then
increments
it in case it doesn't exists. The same thing goes for PUSH, it creates the list
if
there's no list... This is convenient, but it also produces unexpected
behaviour in
some cases.
The other thing is consistency around the nodes..
{{{
Master node:
12:00 PUSH foo 1
12:01 EXPIRE foo 5
... after some time ...
12:05 PUSH foo 2
Node (~2 sec latency, master timestamp in [])
12:02 [12:00] PUSH foo 1
12:03 [12:01] EXPIRE foo 5 /* dies @ 12:06 */
... after some time ...
12:07 [12:05] PUSH foo 2 /* foo was still live @ 12:05 */
}}}
... in this case you know what to do with the second push - it could fail
silently.
It's hard to imagine completely time independant model when EXPIRE is one of
the
available commands...
Original comment by [email protected]
on 2 May 2009 at 8:32
from redis.
Related Issues (20)
- BRPOPLPUSH return type is contingent on success HOT 2
- A 8G .aof file lead redis loading so slowly... HOT 3
- The command "config get databases" does not return
- Allow SORT Command to STORE results as sorted set HOT 1
- Even after flushall maxmemory shows the previous max value. HOT 10
- [FEATURE REQUEST]HMSETX/HSETX HOT 3
- BRPOPLPUSH and a single LPUSH with several items doesn't work well together HOT 2
- Suggestion on either using AOF or Save setting HOT 4
- [FEATURE REQUEST]maxmemory-policy HOT 4
- The issue about the special scenario in redis-2.2.12 HOT 5
- setex silent data loss when using unix time for expiration value HOT 4
- Need Git Tag for 2.2.13 HOT 1
- DBNUM Command HOT 4
- EXPIREAT make test fails
- Hello, antirez. At what time release b-tree version disk store? HOT 1
- make test error CentOS HOT 2
- Could not connect to Redis at 127.0.0.1:6379: Connection refused HOT 1
- configure bind two interface
- minor change (call to id instead of whoami) in install script HOT 1
- /
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redis.