Search in sources :

Example 1 with VendorIdCacheKey

use of org.folio.config.cache.VendorIdCacheKey in project mod-kb-ebsco-java by folio-org.

the class EholdingsPackagesImpl method getCustomProviderId.

private CompletableFuture<Long> getCustomProviderId(RMAPITemplateContext context) {
    VendorIdCacheKey cacheKey = VendorIdCacheKey.builder().tenant(context.getOkapiData().getTenant()).rmapiConfiguration(context.getConfiguration()).build();
    Long cachedId = vendorIdCache.getValue(cacheKey);
    if (cachedId != null) {
        return completedFuture(cachedId);
    } else {
        return context.getProvidersService().getVendorId().thenCompose(id -> {
            vendorIdCache.putValue(cacheKey, id);
            return completedFuture(id);
        });
    }
}
Also used : VendorIdCacheKey(org.folio.config.cache.VendorIdCacheKey)

Aggregations

VendorIdCacheKey (org.folio.config.cache.VendorIdCacheKey)1