Web Vuser Functions (WEB) > Alphabetical List of Web Vuser Functions > web_load_cache

web_load_cache

Load the Vuser cache from a file.

int web_load_cache( const char *Name, const char *fileName, LAST );
Argument
Description
Name
The label of the step in the Graphical Vuser script. Also used as the transaction name for automatic transactions.
fileName
The full pathname of the file to store the cache.
LAST
A marker that indicates the end of the argument list.

Return Values

This function returns LR_PASS (0) on success, and LR_FAIL (1) on failure.

Parameterization

All string arguments (char type) can be parameterized using standard parameterization.

General Information

web_load_cache restores the browser cache from a file. It is used together with web_dump_cache to implement Vuser persistent caching. The script always runs with the same initial cache.

The purpose is to capture the browser cache once, while running the script manually. Then the same cache can be used repeatedly in tests. Using Vuser persistent caching improves CPU usage on the application and database servers.

After recording the script, add web_load_cache at the beginning and web_dump_cache at the end of either the Action or vuser_end section, as appropriate to your test. Run the script once with the web_load_cache call commented out. Then uncomment the web_load_cache call and comment out the web_dump_cache call. The result is that on each run the cache you created is reloaded.

The filename path must point to the file saved with web_dump_cache. It is possible, however, to use a relative path where an absolute path was used to save, or an absolute path where a relative was used to save.

File names can be parameterized, so that different Virtual Users or different iterations use different files. For example, "FileName=Iteration{param}.cache"

Note: If the script is not developed on the machine that will be running the tests, ensure that the cache files are accessible to the host at the path given in fileName.