Package com.apicatalog.jsonld.loader
Class LRUDocumentCache
- java.lang.Object
-
- com.apicatalog.jsonld.loader.LRUDocumentCache
-
- All Implemented Interfaces:
DocumentLoader
public class LRUDocumentCache extends java.lang.Object implements DocumentLoader
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classLRUDocumentCache.CacheKey
-
Field Summary
Fields Modifier and Type Field Description private LruCache<java.lang.Object,Document>cacheprivate DocumentLoaderdocumentLoader
-
Constructor Summary
Constructors Constructor Description LRUDocumentCache(DocumentLoader documentLoader, int cacheSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.ObjectcreateCacheKey(java.net.URI url, DocumentLoaderOptions options)DocumentloadDocument(java.net.URI url, DocumentLoaderOptions options)Retrieve a remote document.
-
-
-
Field Detail
-
documentLoader
private final DocumentLoader documentLoader
-
-
Constructor Detail
-
LRUDocumentCache
public LRUDocumentCache(DocumentLoader documentLoader, int cacheSize)
-
-
Method Detail
-
loadDocument
public Document loadDocument(java.net.URI url, DocumentLoaderOptions options) throws JsonLdError
Description copied from interface:DocumentLoaderRetrieve a remote document.- Specified by:
loadDocumentin interfaceDocumentLoader- Parameters:
url- of the remote document to fetchoptions- to set the behavior of the loader- Returns:
Documentrepresenting a remote document- Throws:
JsonLdError- if the document loading fails
-
createCacheKey
protected java.lang.Object createCacheKey(java.net.URI url, DocumentLoaderOptions options)
-
-