java - Automatic cache refresh with Guava -



forum (how automatically refresh cache using google guava?), learn guava.
wanted ask information above topic (how automatically refresh cache using google guava?) can't write comments questions because reputation low. consequently, have create new topic. thank understanding.

seeing code,

loadingcache<k, v> cache = cachebuilder.newbuilder()         .refreshafterwrite(15, timeunit.minutes)         .maximumsize(100)         .build(new mycacheloader()); 

if 1 entry loaded value @ least 1 time, above code sufficient reload automatically every 15 minutes value associated key ?

of course, mentioned frank, "i override cachebuilder.reload(k, v) method in mycacheloader performs asynchronously." or have code add ? if yes, ? thank much

ps: jb, javadoc perfect level in english low. in fact, overridden reload of cacheloader see if real reload has performed key, , if yes, realize real reload key; otherwise not make real reload of cache key. and, in second case (no real reload), have call of overridden reload method every 15 minutes ? think right ? thanks

a loadingcache built with

loadingcache<k, v> cache = cachebuilder.newbuilder()         .refreshafterwrite(15, timeunit.minutes)         .maximumsize(100)         .build(new mycacheloader()); 

will not refresh automatically itself entry every 15 minutes, cache not create threads kind of management (expiring or refreshing entries). if call cache.get(somekey) call again 20 minutes later, then refresh entry consequence of call, provided entry has not been evicted due maximumsize being reached, of course.

i'm not quite sure you're asking cacheloader::reload , asynchronicity. if overrode it, added code, didn't you? it's not call super.reload(k, v), not asynchronous. can complete question more details if needed.

however, mentionned before, method not called automatically every 15 minutes present key, it's called on demand when entry requested again.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -