Caching

Caching

Caching can mostly improve speed when creating multiple output files or processing a report repeatedly. Cache is controlled over oXFRX Object.

Caching is disable by default.

Caching is available from XFRX 25.0

 

There are 3 cache types: Report meta data, Font data and Images data.

Report meta data

After the output file is finalized XFRX doesn't clear report meta data, but saves them to a cache.  Report meta data cache is controlled by SetReportCache() method.

Font data

After the output file is finalized XFRX doesn't clear font data, but saves them to a cache. Font data cache is controlled by SetFDCache() method.

Images data

After the output file is finalized XFRX doesn't clear image data, but saves them to a cache. Images data cache is controlled by SetImagesCache() method.

Global and local cache

Cache can be global (on oXFRX Object) or local (on instance of XFRX#INIT or PDFL#INIT) and is controlled by SetGlobalCache() method.

Example of enabling cache

LOCAL m.loSession, m.lnRetVal, m.lcFile USE Customers m.loSession=EVALUATE([xfrx("XFRX#INIT")]) * Enable global cache _Screen.oXFRX.SetGlobalCache(.T.) * Enable report metadata cache _Screen.oXFRX.SetUseReportCache(.T., .T.) * Enable font data cache _Screen.oXFRX.SetFDCache(.T.) * Enable images data cache _Screen.oXFRX.SetImagesCache(.T.) SELECT Customers SCAN ALL m.lcFile="Customer_"+LTRIM(STR(CustNo, 11))+".pdf" m.lnRetVal = m.loSession.SetParams(m.lcFile, , , , , , "PDF") IF m.lnRetVal = 0 m.loSession.ProcessReport("report1", , , "NEXT 1") m.loSession.ProcessReport("report2", , , "NEXT 1") m.loSession.finalize() ELSE ? m.lnRetVal, m.loSession.ErrorMessage(m.lnRetVal) ENDIF ENDSCAN RELEASE m.loSession