binary protocol incr/decr proof-of-concept

Dustin Sallings dustin at
Mon Jul 30 16:35:16 UTC 2007

On Jul 30, 2007, at 2:08 , ‏Alex Stapleton wrote:

> I quite like the idea of being able to specify the default value,  
> however I am yet to actually think of a use for it myself :)

	I couldn't think of a case for counters where I wouldn't need them  
to be initialized at some point.  I implemented both cases just in  
case someone does want their initialization and usage separate.  As  
the counter isn't persisted anywhere, hopefully nobody's doing  
anything mission-critical with it.

> Is the default value changed by the amount if the key does not yet  
> exist?

	I don't think that's very intuitive, but that's a bit subjective.   
It made sense to me to set and return the default value when the key  
doesn't exist.

> What happens at integer wrap around? (What happens at the moment as  
> well?) Are we clamping or just letting it overflow?

	The current protocol doc says that underflow is detected, but  
overflow isn't.  I assume that means it'd wrap.  We could also define  
it to fault or jump to the (specified) default again.

Dustin Sallings

More information about the memcached mailing list