Thursday, July 29th, 2010

MySQL Cache Script
Root page of JMan's Bedpan
A short little bio of JMan and JMan's Bedpan
Some PHP scripts that JMan has written, for public use. MSN Emoticons, Weather, Webcam, Latest Version, Cache, HotScripts
Other random stuff that doesnt belong on any other page. Family Feud Cheat, I *Heart* James, Stupidest Famous Last Words, Funny Search Engine Queries, Funny Euphemisms
Rants by Blakey
A bunch of useful links
. : : MySQL Cache Script

This script cache's a variable or an array of variables for a specified amount of time in a MySQL table. Useful for pages that fetch data from other websites, so that you don't have to query the remote site every time you want data. Requires MySQL


Explanations:

cache.php - The script page. Include it in the page you need caching with, then call its functions.
gpl.txt - A copy of the General Public License.
readme.txt - A quick readme file.
SQL.sql - The SQL table.


EXAMPLE:

<?
# Format: 
# cache($id, $seconds, $data) 
#    $id is a unique indentifying string 
#    $seconds is the number of seconds you want to cache the data 
#    $data is what you want cached 

include ("cache.php");
$cached cache("animals"); 
if (
$cached){ //CHECK IF IT'S ALREADY CACHED 
    
$test $cached
    echo 
"\n<br>CACHED DATA\n<br>"
}else{ 
//AQUIRE THE DATA, THEN CACHE IT 
    
$test = array('turtle'"monkey"date("M j, Y"time()), "fish"); 
    
$cached cache("animals"60$test); //CACHES FOR 60 SECONDS
    
echo "\n<br>FRESH DATA\n<br>"
//DO WHATEVER TO THE DATA 
//print_r(slash($test, 2));
print_r($test);
?>

-- DOWNLOAD --
779 Downloads To Date

HotScripts.com
Rating: Not Yet Rated / 5
Votes: 0
Hits: 0

LASTEST UPDATES:
December 31, 2005
Changed format, so now you specify the length of time to cache it for at the time of caching.

No comments for this page. Feel free to be the first.

Add a Comment (Max: 1 Per Hour)

Please make sure that your comment pertains to this page. If it has nothing to do with this page, I'll just delete it. If you want, you can send me an email here: jman@bedpan.ca.

Name :
Email or URL :
Verification :
All fields are required for submission. Entries with blank fields will not be posted.

disclaimer:
the comments posted throughout my site are submitted by other users.
the things said are not endorsed by me, and do not represent my opinion.