All docs
V17.2
24.1
The page you are viewing does not exist in version 24.1.
23.2
The page you are viewing does not exist in version 23.2.
23.1
The page you are viewing does not exist in version 23.1.
22.2
The page you are viewing does not exist in version 22.2.
22.1
The page you are viewing does not exist in version 22.1.
21.2
The page you are viewing does not exist in version 21.2.
21.1
The page you are viewing does not exist in version 21.1.
20.2
The page you are viewing does not exist in version 20.2.
20.1
The page you are viewing does not exist in version 20.1.
19.2
The page you are viewing does not exist in version 19.2.
19.1
The page you are viewing does not exist in version 19.1.
18.2
18.1
17.2
A newer version of this page is available. Switch to the current version.

jQuery SPA Framework - ViewCache

An object that stores information about views displayed in the application.

import ViewCache from "devextreme/framework/view_cache"
Type:

Object

An application uses the viewCache object to save information on the views that were displayed so that this information is used the next time these views are displayed. This allows you to avoid gathering information on a view each time it is displayed and thus shorten the time a view display process takes. You may need to access the application's view cache. To access the application's view cache, use the viewCache field of the HtmlApplication object.

You can influence the way the application's view cache works. In addition, you can provide a custom view cache object to be used by the application. For details, refer to the description of the viewCache application configuration option.

Methods

This section describes the methods used to manipulate the application's view cache.

Name Description
clear()

Removes all the viewInfo objects from the cache.

getView(key)

Obtains a viewInfo object from the cache by the specified key.

hasView(key)

Checks whether or not a viewInfo object is contained in the view cache under the specified key.

off(eventName)

Detaches all event handlers from a single event.

off(eventName, eventHandler)

Detaches a particular event handler from a single event.

on(eventName, eventHandler)

Subscribes to an event.

on(events)

Subscribes to events.

removeView(key)

Removes a viewInfo object from the cache by the specified key.

setView(key, viewInfo)

Adds the specified viewInfo object to the cache under the specified key.

Events

This section describes events fired by the ViewCache object.

Name Description
viewRemoved

Fires after an item is removed from the view cache.