INCR is atomic. An application should not be connected to multiple memcache
servers because key sharding will cause certain keys to have an affinity for
certain instances of memcache.

Expiration works in Memcache lazily if items have not been evicted from the
cache in according with LRU (Least Recently Used): on a GET of a value, the
client checks the expiration to see if the item has expired or not. If so,
the value is not returned to the user and is explicitly expired. Incremented
values are stored in Memcache as Strings, so in your example, what *should*
happen is that an expiration is set such that when you do a GET, if the
value is past its expiration time, it will not return. Have you been seeing
different behavior in your testing?

On Thu, Dec 10, 2009 at 12:26 PM, N Panar <infinityminusn...@gmail.com>wrote:

> memcache.incr() is supposed to increment a key transactionally, so
> that two clients can't clobber each other ... but can the application
> expect to be connected to ever be connected to more than one memcache
> server that each have different values? (it is expected that is
> possible that it will be connected to zero memcache servers).
>
>
> Also, how does expiration interact with incr()? There isn't a time
> flag for incr(), but what happens if I add the key with another call
> rather than using the initial_value flag, like so:
>
>    memcache.add('rlcnt-%s-%s' % (op, ip_h), 0, time=60*90)
>    newcnt = memcache.incr('rlcnt-%s-%s' % (op, ip_h))
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to google-appeng...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine+unsubscr...@googlegroups.com<google-appengine%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>
>
>


-- 
Ikai Lan
Developer Programs Engineer, Google App Engine

--

You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.


Reply via email to