Class ResourceCacheService
java.lang.Object
org.springframework.ai.transformers.ResourceCacheService
Service that helps caching remote
Resource
s on the local file system.- Author:
- Christian Tzolov
-
Constructor Summary
ConstructorDescriptionResourceCacheService
(File rootCacheDirectory) ResourceCacheService
(String rootCacheDirectory) -
Method Summary
Modifier and TypeMethodDescriptionvoid
org.springframework.core.io.Resource
getCachedResource
(String originalResourceUri) GetResource
representing the cached copy of the original resource.org.springframework.core.io.Resource
getCachedResource
(org.springframework.core.io.Resource originalResource) GetResource
representing the cached copy of the original resource.void
setExcludedUriSchemas
(List<String> excludedUriSchemas) Overrides the excluded URI schemas list.
-
Constructor Details
-
ResourceCacheService
public ResourceCacheService() -
ResourceCacheService
-
ResourceCacheService
-
-
Method Details
-
setExcludedUriSchemas
Overrides the excluded URI schemas list.- Parameters:
excludedUriSchemas
- new list of URI schemas to be excluded from caching.
-
getCachedResource
GetResource
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) GetResource
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()
-