Class CachingDocumentSource
java.lang.Object
org.springframework.graphql.support.CachingDocumentSource
- All Implemented Interfaces:
 DocumentSource
Base class for 
DocumentSource implementations providing support for
 caching loaded documents.- Since:
 - 1.0.0
 - Author:
 - Rossen Stoyanchev
 
- 
Constructor Summary
ConstructorsConstructorDescriptionCachingDocumentSource(DocumentSource delegate) Constructor with theDocumentSourceto actually load documents. - 
Method Summary
Modifier and TypeMethodDescriptionvoidRemove all entries from the document cache.reactor.core.publisher.Mono<String> getDocument(String name) Return the document that matches the given name.booleanWhethercachingis enabled.voidsetCacheEnabled(boolean cacheEnabled) Enable or disable caching of resolved documents. 
- 
Constructor Details
- 
CachingDocumentSource
Constructor with theDocumentSourceto actually load documents.- Parameters:
 delegate- the delegate document source
 
 - 
 - 
Method Details
- 
setCacheEnabled
public void setCacheEnabled(boolean cacheEnabled) Enable or disable caching of resolved documents.By default, set to
true.- Parameters:
 cacheEnabled- enable iftrueand disable iffalse
 - 
isCacheEnabled
public boolean isCacheEnabled()Whethercachingis enabled. - 
getDocument
Description copied from interface:DocumentSourceReturn the document that matches the given name.- Specified by:
 getDocumentin interfaceDocumentSource- Parameters:
 name- the name to use for the lookup- Returns:
 Monothat completes either with the document content or with an error, but never empty.
 - 
clearCache
public void clearCache()Remove all entries from the document cache. 
 -