Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 14 in printed book and digital formats -- plus a one-year subscription so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 13.6 ('Stay Out of Jail')
Instant purchase and download via GumRoad!

COLUMN

Column

Issue: 13.6 (November/December 2015)
Author: Marc Zeedar
Author Bio: Marc taught himself programming in high school when he bought his first computer but had no money for software. He's had fun learning ever since.
Article Description: No description available.
Article Length (in bytes): 15,065
Starting Page Number: 62
Article Number: 13607
Resource File(s):

Download Icon 13607project.zip Updated: 2015-11-03 14:44:05

Related Link(s): None

Excerpt of article text...

If you've been around computers for a while, you've no doubt heard the term cache. You probably even know what it means and you're aware that certain programs—such as your web browser—use it. But have you thought of using a cache in your own projects?

A cache is simply saved data. The most common user-level usage (I won't count processor-level caches for the purposes of this article) is the way a web page saves downloaded data—images, fonts, scripts, HTML elements, etc.—so that if you load the same page or a page with the same item it doesn't have to be re-downloaded from the web. With slower data connections, that can save time, even when you consider the overhead of managing the cache.

A Cache Example from xDev

Sometimes needing a cache is obvious. One situation where I've used a cache is for creating this magazine's website. The site is generated using a program (actually several programs) I wrote years ago. The key slow portion is the part that parses each issue's collection of articles (in XML format) and generates HTML pages and table of contents for those articles. (Yes, the site is static HTML, not database-generated. I'm behind the times.)

Back when I first set this up, we only had a few magazine issues published, so the creation of the site was almost instantaneous. Over the years as more and more articles were available, this task grew slower and slower, but it was still only a minute or so. Since I usually only re-generate the site every two months (each time a new issue comes out), a minute or two wasn't a big deal.

But now we've published over 80 issues and a few years ago I started getting annoyed that the process took many minutes. Even dumber, since I rarely change old issues (except for occasionally fixing an error), most of that time was spent on regenerating the exact same HTML that was already on disk! (The past issues.)

...End of Excerpt. Please purchase the magazine to read the full article.