web_dump_cache
Save the Vuser cache to a file.
int web_dump_cache( const char *Name, const char *fileName, [ const char *Replace], 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. |
Replace | Overwrite existing file: "yes" or "no". |
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_dump_cache saves the browser cache. It is used together with web_load_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 pathcan be absolute (e.g., "FileName=c:\\MyDir\\User1.cache") or relative to the current Virtual User directory (e.g., "FileName=Iteration1.cache"). Note that cache files folder must be created before running the dump command
If you use relative filenames, the files are copied with the script when saving to a new location, or copying to an load generator host. This behavior is platform independent and independent of drive mappings and network locations.
Use absolute path names only if you do not want the cache file to be linked to the script. For example, if you wish to use a different cache on each host, use absolute paths to prevent the cache from the development machine overwriting the host cache each time you enhance the script.
The file extension is ".cache". It is added even if not specified. For example, if you enter "FileName=Iteration2.txt", the cache file is "FileName=Iteration2.txt.cache".
File names can be parameterized, so that different Virtual Users or different iterations use different files. For example, "FileName=Iteration{param}.cache"
Replace specifies whether to replace the file if it exists already ("Replace=yes") or not ("Replace=no"). The default is "Replace=yes".
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.