React SPA Framework - ViewCache Deprecated

include spa-deprecated-note

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.