jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Gaul <notificati...@github.com>
Subject Re: [jclouds/jclouds-labs] JCLOUDS-1005: Backblaze B2 skeleton and bucket ops (#270)
Date Sat, 28 May 2016 19:56:03 GMT
> +      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
Mime
View raw message