Guava缓存

google的缓存,用起来很方便,功能强大
缓存


例子ide


//缓存offerVos函数

        private static LoadingCache<String, List<OfferVO>> offerVosCacheui


        = CacheBuilder.newBuilder().google

                    //设置10s没有更新数据则会移除数据rem

                            expireAfterWrite(15, TimeUnit.SECONDS).回调函数

                    //设置缓存个数,达到则开始使用LRU策略回收it

                            maximumSize(1000).class

                    //移除时回调函数List

                            removalListener(removalListener).

                            build(cacheLoader);

        }


这里只用了其部分功能

相关文章
相关标签/搜索