The Enterprise Edition of CountryHawk keeps a running total of all statistics in memory. This means that once the application or web services that use CountryHawk are restarted, the statistics will be zeroed. This is a static method.
The CountryStats class provides the PeristToFile and LoadFromFile methods that are used to persist all collected statistics to a file on your server and later reload these statistics back into memory so that additional lookups performed by CountryHawk will be added to the existing results.
Syntax:
chStatsObj.PersistToFile([pathAndFileName])
pathAndFileName: Optional. If specified, the statistics are read from the path and file name specified by this parameter. If omitted (default), the statistics are read from the path and file name specified by the country.stats.file property listed in the countries.properties file.
Returns:
This method does not return any result. Upon successful execution, all statistics written by a previous call to the PerisistToFile method are loaded into memory. Statistics gathered by additional CountryHawk lookups then are added to these totals. If an error occurs during its operation it raises a run-time error with a description of the problem.
VB.NET Example:
CountryStats.LoadFromFile()
C# Example:
CountryStats.LoadFromFile();
Note: This method requires the Enterprise Edition of CountryHawk.
Tip: By default if you have previously used the PersistToFile method, CountryHawk automatically will load the persisted statistics upon the next start up. Therefore there is no need to explicitly instruction CountryHawk to load the stats using the LoadFromStats method unless you wish to specify a specific data file location, or unless you wish to reload the statistics from their last saved point.
See Also: