google app engine的缓存服务解决性能问题

google app engine,说起来都很激动,用起来其实上火,尤其是data store

SQl,用不了,hibernate,用不了,or查询,用不了,!=查询,会被拆成N个query来执行。。。。

data store功能太简单,性能就成问题,这样的东西大概看了都会上火:
google app engine的缓存服务解决性能问题

没办法了,缓存出动吧:

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.cache.Cache;
import javax.cache.CacheException;
import javax.cache.CacheFactory;
import javax.cache.CacheManager;

Map props = new HashMap();
props.put(GCacheFactory.EXPIRATION_DELTA, 60*60*24);//expiration time, in seconds
CacheFactory cacheFactory = CacheManager.getInstance().getCacheFactory();
Cache cache=cacheFactory.createCache(props);

//放个东东
cache.put("SexyGirls", new ArrayList<String>());

//取个东东
List<String> list=(List<String>)cache.get("SexyGirls");


加了缓存以后的:

google app engine的缓存服务解决性能问题

你可能感兴趣的:(java,sql,Hibernate,cache,Google)