Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Cache File Locking

August 4, 2000

I'm performing some complex SQL selects to generate some of these cached modules. Some of them are taking longer than I would like, but priorities demand that I concentrate on tasks other than database performance. I simply added some cron tasks to automate the refreshing of modules in coordination with their tag REFRESH tag. The cron tasks simply request the page from the web server.

However, I was concerned with multiple users hitting the server initiating redundant SQL executions, which would unnecessarily increase the load on the database.

I used a simple locking solution. If the script determines that a cache file needs to be updated, it creates a lock file that indicates the cache file is already being generated. Subsequent requests for that same cache file notice that the lock file exists and wait until that lock file is removed by the initial script and then grabs the cache file when it finishes.

Hopefully, with these enhancements, this solution becomes even more powerful while making it easier to implement for the developer.

You should be able to cut and paste it into your own solution.

Manual Cache File Naming
Another Look At "Building Your Website With Cached Dynamic Modules"
The Full Code


Up to => Home / Authoring / Languages / PHP / Dynamic_Modules2




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers