File Caching
Caching is developed specially for the TableProcessor object and helps a lot when you need process several tables consequently on a page that is retrieved from the Internet or read from a local file. When you process a page for the first time, the TableProcessor saves its content to the internal memory. Thus, when you process that page for the second time and more, saved content will be used instead of retrieving the page from the Web or local file again and again. For example, if you process 100 tables consequently on one page, and retrieving of the page takes about 3 seconds (with a good Internet connection) and processing of a single table on the page takes 3 seconds, without caching, this all will take: 100x(3+3) = 600 sec, or 10 min. With caching turned on, this will take 3+100x3 = 303 sec, or almost 2 times shorter. However, version 4.0 features the new SmartIndexing algorithm that makes all the process even dozens times more faster!
Two more members to the TableProcessor object were added to handle caching: CacheFile - set True to enable caching. ResetParser - Invoke to clear the saved content. Note that if you change the FileName property value and launch processing, this will make the TableProcessor refresh the cache, so you don't need to reset the parser each time you want to parse a new file. However, one must not forget that cache content is saved in the object internal memory. So, when the object is destroyed, cache content is lost. This means that if you want to cache the application-wide data, you must declare the TableProcessor object as a global one for application (see the new Table Processor Console sources for details). Here is an example in Visual Basic of implementing File Caching in TableProcessor:
Dim myTableProcessor
As
HTMLProducer.TableProcessor
...
myTableProcessor.ProcessFile = True
'process a web page from a file
myTableProcessor.FileName = "http://www.mywebserver.com/index.html"
myTableProcessor.CacheFile = True
'enable caching of the file
...
|