[英]Is entity key in memcache the same as in datastore
当我像这样设置memcache实体的键时
syncCache.put(entityKey, entity);
哪里
entityKey = entity.getKey();
entityKeyIdFromDataStore = entityKey.getId();
然后我检索存储在memcache中的实体并检索密钥ID
entity = (Entity) syncCache.get(entityKey);
entityKeyIdFromCache = entity.getKey().getId();
然后,entityKeyIdFromDataStore和entityKeyIdFromCache会相同吗?
是的,会一样。 请注意,您可以使用ID代替密钥:
syncCache.put(entityKey.getId(), entity);
entity = (Entity) syncCache.get(entityKey.getId());
ID比密钥短得多。 当然,这仅适用于没有父母的实体,或者仅在Memcache中存储一种实体。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.