Working with the Chart Cache

When ColdFusion MX generates a chart via the cfchart tag, the actual image, whether it is a SWF, PNG, or JPG file, is rendered from a memory cache or a disk cache. By default, all images generated by cfchart are cached to disk. If you have access to the ColdFusion Administrator, you can configure exactly how the cfchart tag caches images that it creates. To do this, log into the ColdFusion Administrator, and choose the Charting link on the left hand side of the screen. This takes you to the Charting Settings section of the ColdFusion Administrator, shown in Figure 17-10.

Charting Settings in the ColdFusion Administrator

Figure 17-10. Charting Settings in the ColdFusion Administrator

In the Charting Settings section, you can set the caching mechanism via a dropdown box to either Disk (the default) or Memory. The next section allows you to specify the maximum number of images to allow in the cache at any one time. Caching images allows multiple requests that generate the same image to process much more quickly than having cfchart generate a new image every time someone requests the same chart. In the third section, you can set the maximum number of charts that can be processed concurrently. The higher the number, the more memory is required for the operation. The final section allows you to specify a directory location to use to store chart files if you set ColdFusion to use a disk cache. Note that the ...

Get Programming ColdFusion MX, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.