我使用了 GWT 2.4 和 GAE 1.7.4。在我的数据存储中,我使用 blob 存储图像。**我已经将所有数据放在 **memcache 中,每次刷新主页读取配额后都会增加 1%。
我的代码如下
public List<CastDTO> getAll() {
List<CastDTO> dtoList = new ArrayList<CastDTO>();
//Use Memcache more efficiently, Increase caching of frequently accessed shared data
final MemcacheService syncCache = MemcacheServiceFactory.getMemcacheService();
syncCache.setErrorHandler(ErrorHandlers.getConsistentLogAndContinue(Level.INFO));
List<Cast> cacheCastsList = (List<Cast>) syncCache.get(StaticData.CAST_LIST);
if(cacheCastsList == null){
cacheCastsList = castDAO.findAll();
for (Cast cast : cacheCastsList) {
dtoList.add(CastConverter.convert(cast));
syncCache.put(cast.getCastName(), cast.getCastImage());
}
syncCache.put(StaticData.CAST_LIST, cacheCastsList);
}else{
for (Cast cast : cacheCastsList) {
dtoList.add(CastConverter.convert(cast));
}
}
return dtoList;
}