Code example for LoadingCache

Methods: putgetUnchecked

0
         return null; 
      String containerName = from.getContainer();
      if (containerName == null)
         return null; 
      try { 
         URI uri = cdnContainer.getUnchecked(containerName);
         if (uri == NEGATIVE_ENTRY) {  // intentionally use reference equality
            // TODO: GetCDNMetadata.load returns null on failure cases.  We use 
            // a negative entry to avoid repeatedly issuing failed CDN queries. 
            // The LoadingCache removes this value after its normal expiry. 
            return null; 
         } 
         return uriBuilder(uri).clearQuery().appendPath(from.getName()).build();
      } catch (CacheLoader.InvalidCacheLoadException e) {
         // nulls not permitted from cache loader 
         cdnContainer.put(containerName, NEGATIVE_ENTRY);
         return null; 
      } catch (NullPointerException e) {
         // nulls not permitted from cache loader 
         // TODO this shouldn't occur when the above exception is reliably presented 
         return null; 
Experience pair programming with AI  Get Codota for Java