
本文共 3163 字,大约阅读时间需要 10 分钟。
������������������������������������������Guava���������Caffeine������������������������������������������������������������������������������������������������������������������������load���������loadall������������������������������������������
��������������������������������������������������������������� cache.get(id)���������������������������������������������load������������������������
������������������������������������������������������������������������cache.getAll(ids)���������������������������������������������loadAll������������������������
������������������������������������������������������������������������������������������cache.getAll(ids)������������������������load������������������������������������������������������������������������������������������������������redis������������������redis������������������������������������������������������
batchNumCache = Caffeine.newBuilder() .initialCapacity(cacheSize) .maximumSize(cacheSize) .refreshAfterWrite(cacheTime, TimeUnit.SECONDS) .build(new CacheLoader>() { @Override public Map load(Long batchId) throws Exception { return getBatchNumJimdb(batchId); } @Override public Map > loadAll(Iterable batchIds) throws Exception { if (Iterables.isEmpty(batchIds)) { return null; } return getAllBatchNumJimdb(Lists.newArrayList(batchIds)); } });
���������������������������load���������������getBatchNumJimdb������������������loadAll���������������getAllBatchNumJimdb���������������getAllBatchNumJimdb���������������������������������redis���pipeline���������������������������redis������������������������������
������������������������������������������������������������������������������������������������������������������������ut������������������������expireAfterWrite���������������������������������������������������
batchNumCache = Caffeine.newBuilder() .initialCapacity(cacheSize) .maximumSize(cacheSize) .refreshAfterWrite(cacheTime, TimeUnit.SECONDS) .expireAfterWrite(cacheTime, TimeUnit.SECONDS) .build(new CacheLoader>() { @Override public Map load(Long batchId) throws Exception { return getBatchNumJimdb(batchId); } @Override public Map > loadAll(Iterable batchIds) throws Exception { if (Iterables.isEmpty(batchIds)) { return null; } return getAllBatchNumJimdb(Lists.newArrayList(batchIds)); } });
������������������������ok���������������cache.get������������������load������������������cache.getall������������������loadall���������
发表评论
最新留言
关于作者
