http://www.linux-mag.com/2002-09/lamp_01.html). And since the query cache is disabled by default, there’s a good chance you’ve not stumbled across it yet.
When MySQL 4.0 was released, it included a host of new features. We’ve already discussed MySQL 4.0 several times in Linux Magazine, but the query cache only received a brief mention in the September 2002 “LAMP Post” column (available online at http://www.linux-mag.com/2002-09/lamp_01.html). And since the query cache is disabled by default, there’s a good chance you’ve not stumbled across it yet.
When MySQL 4.0 was released, it included a host of new features. We’ve already discussed MySQL 4.0 several times in Linux Magazine, but the query cache only received a brief mention in the September 2002 “LAMP Post” column (available online at http://www.linux-mag.com/2002-09/lamp_01.html). And since the query cache is disabled by default, there’s a good chance you’ve not stumbled across it yet.
Remember This
The idea behind the query cache is quite simple. Many applications, especially web-based applications, issue repetitive database queries. These queries needlessly waste resources on the database server and slow down the application. And it just feels wrong.
Most developers who walk into a situation like this quickly realize what’s needed — a server-side cache. Typically you’d build a caching layer on the web server using flat files, Berkeley DB, shared memory, or the like.
Building your own caching system isn’t terribly difficult, but it does take time and involves writing extra code. You’ll benefit from code that’s written specifically for your application, but in doing so you’ll also have to make many decisions about cache policy and other details. How do items expire from the cache? Is it a least-recently-used (LRU) cache? Do you assign a time-to-live (TTL) to each cached item? Can the application override or bypass the cache?
The bottom line is that you’re going to spend some effort to get this all figured out, coded, tested, and deployed. All that just to make your application remember things instead…
Please log in to view this content.
Not Yet a Member?
Register with LinuxMagazine.com and get free access to the entire archive, including: