[英]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.