The lower level MemcacheService is different from the service provided by the jache api (a.k.a. memcache). The lower level MemcacheService that you are accessing is more volatile and so in between checking for existence of a key and getting that value, the value may have been disappeared (reclaimed by the garbage collector).
This can happen more frequently if the values are soft references. soft references are a way to specify that the garbage collector can remove an object even if it's still referred to by a root object in the heap - the gc would reclaim that object's memory if memory becomes scarce. So in summary, you want to get the value and work with that in one step instead of the less atomic check for existence then get value - that's because this cache implementation is more volatile. On Sep 13, 10:03 am, realdope <[email protected]> wrote: > I took suggestions from Nicole and it seems to be working now.. Although I'm > still uneasy about it. How does contains(key) work? If I store a non-null > value into the Memcache, why would get(key) ever return null? > > What's wrong with the existing code that I posted that Memcache.hasById(id) > always > fails? -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" 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-java?hl=en.
