Is Memcache (Java) for Google App Engine a global cache?

后端 未结 3 1383
借酒劲吻你
借酒劲吻你 2021-02-19 03:27

I\'m new to Google App Engine, and I\'ve spent the last few days building an app using GAE\'s Memcache to store data. Based on my initial findings, it appears as though GAE\'s

3条回答
  •  眼角桃花
    2021-02-19 04:11

    Jerry, there are two issues I see with the code you posted above:

    1) You are using the javax.cache version of the API. According to Google, this has been deprecated: http://groups.google.com/group/google-appengine-java/browse_thread/thread/5820852b63a7e673/9b47f475b81fb40e?pli=1

    Instead, it is intended that we use the net.sf.jsr107 library until the JSR is finalized.

    I don't know that using the old API will cause a specific issue, but still could be trouble.

    2) I don't see how you are putting and getting from the cache, but the put statement you have is a bit strange:

    cache.put(CACHE_GEO_CLIENTS, new HashMap());

    It looks like you are putting a second cache inside the main cache.

    I have very similar code, but I'm putting and getting individual objects into the cache, not Maps, keyed by a unique ID. And it is working fine for me across multiple instances on GAE.

    -John

提交回复
热议问题