org.linkedin.util-core/src/main/java/org/linkedin/util/io/resource/internal/LocalCacheLeafResource.java
public static LeafResource create(Resource resource)
  {
    try
    {
      // if we can access the file then there is no reason to decorate it...
      resource.getFile();
      return new LeafResourceImpl(resource);
    }
    catch(IOException e)
    {
      return new LocalCacheLeafResource(resource);
    }
  }
public static LeafResource create(Resource resource)
  {
    try
    {
      // if we can access the file then there is no reason to decorate it...
      resource.getFile();
      return new LeafResourceImpl(resource);
    }
    catch(IOException e)
    {
      return new LocalCacheLeafResource(resource);
    }
  }
Decorates the resource to implement a caching strategy.

@param resource the resource to cache locally
@return the (locally cached) resource