Link Search Menu Expand Document

4.6 Check Cache Integrity

Most CRS files are cached on the client PC the first time they are downloaded, and will be executed from the cache without downloading from the next time onwards. This feature is essential for speeding up applications, but care must be taken to maintain cache integrity.

Updating the CRS file placed on the server does not automatically update the cache. Managing the cache of the client PC requires the programmer who creates the application to consciously describe the process.

Only the first CRS file loaded from the Root object is not cached. By using this file, you can describe the process to check the consistency of the cache of the client PC.

Use the following function to check the integrity of the cache.

cachedate function
The cachedate function returns the latest modification date of the cache currently held by the client. If there is a file on the server that is newer than this modification date, it is possible that an older version of that file has been cached.

//.DeleteCache method
The DeleteCache method deletes the cache for the specified URL . If you don’t specify a URL , it clears all caches downloaded from the server that downloaded the CRS script that runs the DeleteCache method.

The easiest way is to put it at the beginning of the first loaded CRS file

//.DeleteCache (); It is described as. This method clears all caches on every connection, so there is no cache inconsistency in the CRS file, but performance is degraded.

In general, the method of managing the version number of an application is often used.

This method provides a CRS file , for example named version.crs , that simply sets the version number of your application .

----- version.crs -----
String version = "2.0.0.1";

Write the latest version number in the CRS file that is loaded first, and load version.crs with GET. If the old version.crs is cached, it should be different from the version number of menu.crs as it will be loaded from the cache.

----- menu.crs -----
String curVersion = "2.0.0.2";
Get ("version.crs");
if (curVersion! = version) {
    //.DeleteCache ();
    Get ("version.crs");
}

In this way, cache integrity can be managed in a variety of ways. Make sure to take the best management method according to the characteristics of the application.