GAE 文档说:
Keys and values can be of any Serializable type or class
我使用MultiKey作为键,但更新我的应用程序后,它给了我异常:
java.lang.IllegalArgumentException: Cannot use as a key: 'MultiKey[class com.xx.xx.xx, Key<?>(Domain("xxx.com")/AppUser(2001)), -1, {}, [-lastModified, ]]'
at com.google.appengine.api.memcache.AsyncMemcacheServiceImpl.makePbKey(AsyncMemcacheServiceImpl.java:251)
at com.google.appengine.api.memcache.AsyncMemcacheServiceImpl.doGet(AsyncMemcacheServiceImpl.java:294)
at com.google.appengine.api.memcache.AsyncMemcacheServiceImpl.get(AsyncMemcacheServiceImpl.java:306)
at com.google.appengine.api.memcache.MemcacheServiceImpl.get(MemcacheServiceImpl.java:49)
MultiKey来自 apache commons-collections,它确实实现了 Serializable
public class MultiKey
extends java.lang.Object
implements java.io.Serializable
有任何想法吗?
谢谢。
编辑,代码如下:
MemcacheService ms = MemcacheServiceFactory.getMemcacheService();
MultiKey key=new MultiKey(xx, xx, xx...);
ms.put( key, value );
...