# Cache results This article contains caching use-cases with GroupDocs.Viewer within your JavaScript applications. Caching saves rendering results to a specified location, such as a local disk. When you re-request the rendering results, GroupDocs.Viewer does not render again, but uses the cached results. As a document can take a long time to render, use caching if you expect to reuse the rendering results. To enable caching, follow these steps: 1. Instantiate the desired cache object (for example, [FileCache](#) to store document rendering results at the local drive) 2. Instantiate the [ViewerSettings](#) object. Specify the cache object as a parameter of the constructor. 3. Instantiate the [Viewer](#) object. Specify the [ViewerSettings](#) object as a parameter of the constructor. 4. Call the [view()](#) method of the [Viewer](#) class. The following code snippet shows how to enable caching and displays the difference between rendering a file and getting the cached results: {{< tabs "caching-results">}} {{< tab "JavaScript" >}} ```js import { Viewer, HtmlViewOptions, FileCache, ViewerSettings } from '@groupdocs/groupdocs.viewer'; const cachePath = "cache"; const cache = new FileCache(cachePath); const settings = new ViewerSettings(cache); const viewer = new Viewer("sample.docx", settings) const options = HtmlViewOptions.forEmbeddedResources(); let currentTimeMillis = Date.now() viewer.view(options); currentTimeMillis = Date.now() - currentTimeMillis console.log("Time taken on first call to View method " + currentTimeMillis + " (ms).") currentTimeMillis = Date.now() viewer.view(options) currentTimeMillis = Date.now() - currentTimeMillis console.log("Time taken on second call to View method " + currentTimeMillis + " (ms).") ``` {{< /tab >}} {{< tab "sample.docx" >}} {{< tab-text >}} `sample.docx` is the sample file used in this example. Click [here](https://docs.groupdocs.com/viewer/nodejs-java/_sample_files/developer-guide/caching-results/sample.docx) to download it. {{< /tab-text >}} {{< /tab >}} {{< /tabs >}} The following image shows a sample console output: ![](https://docs.groupdocs.com/viewer/nodejs-java/images/caching-results.png) For details, please refer to the following pages: