> + final Object fakeKey = new Object(); // fake key for single-element
> cache
> + final LoadingCache<Object, Authorization> cache =
> CacheBuilder.newBuilder()
> + .expireAfterWrite(23, TimeUnit.HOURS)
> + .build(CacheLoader.from(new Function<Object, Authorization>() {
> + @Override
> + public Authorization apply(Object nothing) {
> + return b2Api.getAuthorizationApi().authorizeAccount();
> + }
> + }));
> + return new Supplier<Authorization>() {
> + @Override
> + public Authorization get() {
> + return cache.getUnchecked(fakeKey);
> + }
> + };
> + }
Done.
---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/270/files/2a136008e73694853e887a138883638321393bdd#r64993265