public class CacheResourcesManager extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
CacheResourcesManager.ResourceToDeploy
Classpath resource to deploy into the lemminx cache
|
| Modifier and Type | Field and Description |
|---|---|
protected com.google.common.cache.Cache<String,CacheResourceDownloadedException> |
unavailableURICache |
| Constructor and Description |
|---|
CacheResourcesManager() |
CacheResourcesManager(com.google.common.cache.Cache<String,CacheResourceDownloadedException> cache) |
| Modifier and Type | Method and Description |
|---|---|
void |
addProtocolForCahe(String protocol)
Add protocol for using cache when url will start with the given protocol.
|
boolean |
canUseCache(String url)
Returns
true if cache is enabled and url comes from "http(s)" or
"ftp" and false otherwise. |
void |
evictCache()
Remove the cache directory (.lemminx/cache) if it exists.
|
Path |
getResource(String resourceURI) |
static Path |
getResourceCachePath(CacheResourcesManager.ResourceToDeploy resource)
Try to get the cached
CacheResourcesManager.ResourceToDeploy.resourceCachePath in cache
file system and if it is not found, create the file with the given content of
CacheResourcesManager.ResourceToDeploy.resourceFromClasspath stored in classpath. |
static Path |
getResourceCachePath(String resourceURI) |
static Path |
getResourceCachePath(URI uri) |
boolean |
isDownloadExternalResources() |
boolean |
isUseCache()
Returns
true if cache must be used, false
otherwise. |
void |
removeProtocolForCahe(String protocol)
Remove protocol to avoid using cache when url will start with the given
protocol.
|
void |
setDownloadExternalResources(boolean downloadExternalResources) |
void |
setUseCache(boolean useCache)
Set
true if cache must be used, false otherwise. |
protected final com.google.common.cache.Cache<String,CacheResourceDownloadedException> unavailableURICache
public CacheResourcesManager()
public CacheResourcesManager(com.google.common.cache.Cache<String,CacheResourceDownloadedException> cache)
public Path getResource(String resourceURI) throws IOException
IOExceptionpublic static Path getResourceCachePath(String resourceURI) throws IOException
IOExceptionpublic static Path getResourceCachePath(URI uri) throws IOException
IOExceptionpublic static Path getResourceCachePath(CacheResourcesManager.ResourceToDeploy resource) throws IOException
CacheResourcesManager.ResourceToDeploy.resourceCachePath in cache
file system and if it is not found, create the file with the given content of
CacheResourcesManager.ResourceToDeploy.resourceFromClasspath stored in classpath.resource - the resource to deploy if needed.CacheResourcesManager.ResourceToDeploy.resourceCachePath in cache file
system.IOExceptionpublic boolean canUseCache(String url)
true if cache is enabled and url comes from "http(s)" or
"ftp" and false otherwise.url - true if cache is enabled and url comes from "http(s)" or
"ftp" and false otherwise.public void setUseCache(boolean useCache)
true if cache must be used, false otherwise.useCache - true if cache must be used, false
otherwise.public boolean isUseCache()
true if cache must be used, false
otherwise.true if cache must be used, false
otherwise.public boolean isDownloadExternalResources()
public void setDownloadExternalResources(boolean downloadExternalResources)
public void evictCache()
throws IOException
IOException - if the delete of directory (.lemminx/cache) cannot be
done.public void addProtocolForCahe(String protocol)
protocol - the protocol to add.public void removeProtocolForCahe(String protocol)
protocol - the protocol to remove.Copyright © 2022. All rights reserved.