Manage an In-Memory Data Cache

  • 5 minutes to read

This article describes the dashboard’s server-side data caching functionality, corresponding API, and how to update the cached data.

The ASPxDashboard control can display dashboards supplied with data using different types of data sources, which include SQL databases, Excel files, Entity Framework data sources, etc. If a data source uses the Server data processing mode, ASPxDashboard requests data automatically by sending a query containing a corresponding SELECT statement.

If the Client data processing mode is enabled for the data source, ASPxDashboard creates a server-side in-memory cache that stores data from the data source in an optimized way. This capability accelerates specific client-side actions that require data updates (for instance, when you apply master filtering).

Share Cache

The in-memory cache is created when data is loaded for the first time. The Web Dashboard can create several caches to accelerate data loading for different dashboards/data sources. Depending on the server-side API in use, the following specifics are applied to cache sharing:

Use Different Caches for Different User Groups

The Web Dashboard can create several caches to accelerate data loading for different dashboards/data sources. Each cache has its own unique key that contains predefined and custom parts:

  • The first part describes the dashboard object model, including information about the data source.
  • The second part includes dashboard parameters (name-value pairs). You can implement custom logic when handling the CustomParameters event to create different caches.

The caches are shared between all users by default:

You can manage access to different caches for different users. For this, set a unique parameter value for each user group:

To do this in code, handle the ASPxDashboard.CustomParameters / DashboardConfigurator.CustomParameters event as follows:

protected void ASPxDashboard1_CustomParameters(object sender, CustomParametersWebEventArgs e) {
        e.Parameters.Add(new DevExpress.DataAccess.Parameter("UserGroup1", typeof(string), HttpContext.Current.Session["UserGroup1"].ToString()));

The parameter name-value pair is included in the cache key - users get the cache only for the corresponding user group. Parameters added in the CustomParameters event is not passed to the client.

Cache Life Cycle

The Web Dashboard manages the in-memory cache in the following independent ways:

  • The Web Dashboard clears the cache if the time interval between two data requests exceeds 300 seconds. If the time interval between two data requests is less than 300 seconds, the Web Dashboard leaves the old cache unchanged and starts the timer again.
  • The Web Dashboard allows you to set a time interval that specifies how frequently the Web Dashboard should refill its cache when a user sends a data request. You can handle the ASPxDashboard.ConfigureDataReloadingTimeout event to change this time interval. For instance, if you set the ConfigureDataReloadingTimeoutWebEventArgs.DataReloadingTimeout event parameter to 100 seconds, the Web Dashboard updates the cache when a new request is received and the current cache version is created more than 100 seconds ago.

When data is loaded for the first time, the Web Dashboard checks whether any cache exists. If the existing cache is older than 300 seconds, the Web Dashboard recreates it.

Specify the Cache Timeout on the Server

Depending on the used server-side API, handle the following events:

Refresh the Control from the Client Side

To refresh the control on the client side, call the ASPxClientDashboard.Refresh method:


You can also get access to the underlying DashboardControl instance and call the DashboardControl.refresh method:

var dashboardControl = sender.GetDashboardControl();

See Client-Side API Overview for details on how to customize ASPxDashboard on the client side.

Reset the Cache Forcedly

Client Side

Use the ASPxClientDashboard.ReloadData or DashboardControl.reloadData client methods to reload all the dashboard’s data sources.

Server Side

To refresh the data source cache on the server side, pass a unique parameter value to the ASPxDashboard.CustomParameters / DashboardConfigurator.CustomParameters event.

For instance, you can store a unique GUID value within a Session or static variable as a parameter and update its value in your code when you need to refresh the cache.

public static class CacheManager {
    public static void ResetCache() {
        if (HttpContext.Current.Session != null)
            HttpContext.Current.Session["UniqueCacheParam"] = Guid.NewGuid();
    public static Guid UniqueCacheParam
            if (HttpContext.Current.Session == null)
                return Guid.Empty;
            else {
                if (HttpContext.Current.Session["UniqueCacheParam"] == null)
                return (Guid)HttpContext.Current.Session["UniqueCacheParam"];

Pass the parameter to the DashboardConfigurator.CustomParameters / ASPxDashboard.CustomParameters event:

protected void ASPxDashboard1_CustomParameters(object sender, CustomParametersWebEventArgs e) {
        e.Parameters.Add(new DashboardParameter("Param1", typeof(Guid), CacheManager.UniqueCacheParam));

Reset the cache in your code:

public void ResetCache() {