Class ResourceCacheService

java.lang.Object
org.springframework.ai.transformers.ResourceCacheService

public class ResourceCacheService extends Object
Service that helps caching remote Resources on the local file system.
Author:
Christian Tzolov
  • Constructor Details

    • ResourceCacheService

      public ResourceCacheService()
    • ResourceCacheService

      public ResourceCacheService(String rootCacheDirectory)
    • ResourceCacheService

      public ResourceCacheService(File rootCacheDirectory)
  • Method Details

    • setExcludedUriSchemas

      public void setExcludedUriSchemas(List<String> excludedUriSchemas)
      Overrides the excluded URI schemas list.
      Parameters:
      excludedUriSchemas - new list of URI schemas to be excluded from caching.
    • getCachedResource

      public org.springframework.core.io.Resource getCachedResource(String originalResourceUri)
      Get Resource representing the cached copy of the original resource.
      Parameters:
      originalResourceUri - Resource to be cached.
      Returns:
      Returns a cached resource. If the original resource's URI schema is within the excluded schema list the original resource is returned.
    • getCachedResource

      public org.springframework.core.io.Resource getCachedResource(org.springframework.core.io.Resource originalResource)
      Get Resource representing the cached copy of the original resource.
      Parameters:
      originalResource - Resource to be cached.
      Returns:
      Returns a cached resource. If the original resource's URI schema is within the excluded schema list the original resource is returned.
    • deleteCacheFolder

      public void deleteCacheFolder()