I am taking this opportunity to ask one more question in this context.
( Ikai L, Pls suggest. )
I am having an object which has a reference property - Many-to-One to
an object for which I would like to know the feelings of the users.
I am using memcache to increment a feeling name
object = object()
object.reference = db.get(self.request.get('key-stored-in-
html')
object.updateFeeling(self.request.get('feeling'))
This updateFeeling does check the memcache and does like this:
memcache.incr (FeelingShardName)
I am getting an error saying that a transaction should not be done
with different entity groups.(FeelingShardName, objectEntity,
referenceEntity).
I know it is complex to think into other's code, but shall look this
thread for a while if I can find a suggestion.
On Dec 11, 11:04 pm, "Ikai L (Google)" <[email protected]> wrote:
> 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 <[email protected]>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 [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<google-appengine%[email protected]>
> > .
> > 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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.