1. 程式人生 > >阿里巴巴開源的通用快取訪問框架JetCache介紹

阿里巴巴開源的通用快取訪問框架JetCache介紹

GenericObjectPoolConfig pc = new GenericObjectPoolConfig();pc.setMinIdle(2);pc.setMaxIdle(10);pc.setMaxTotal(10);JedisPool pool = new JedisPool(pc, "localhost", 6379);Cache<Long, UserDO> userCache = RedisCacheBuilder.createRedisCacheBuilder() .keyConvertor(FastjsonKeyConvertor.INSTANCE) .valueEncoder(JavaValueEncoder.INSTANCE) .valueDecoder(JavaValueDecoder.INSTANCE) .jedisPool(pool) .keyPrefix("userCache-") .expireAfterWrite(200, TimeUnit.SECONDS) .buildCache();