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);

        }


這裏只用了其部分功能

相關文章
相關標籤/搜索