PHP Classes

Examples

Recommend this page to a friend!

      Ole File Cache  >  All threads  >  Examples  >  (Un) Subscribe thread alerts  
Subject:Examples
Summary:Could you please provide examples?
Messages:3
Author:Larry Epperson
Date:2010-07-15 10:53:19
Update:2010-07-22 13:56:55
 

  1. Examples   Reply   Report abuse  
Picture of Larry Epperson Larry Epperson - 2010-07-15 10:53:19
Could you please provide examples of how to use your script? This could include where the cache is kept, etc.

thank you

  2. Re: Examples   Reply   Report abuse  
Picture of Ole Ole - 2010-07-22 13:39:49 - In reply to message 1 from Larry Epperson
Yes, i will upload some examples as soon as possible, am a little busy atm.

The class is really easy to use, and you choose where to store your cached data by the filename you give the ::load method.

::Load($yourfile_fullpath, $timeToLiveInSeconds);
if this returns ===false then you "cache" is out of date, and you generate your data manually, then save it with ::save($yourfile_fullpath); and then parse your generated data.

There's not much more to it really.. i will write some real examples as soon as i have the time to spare.

Hope this helps for now. :)

  3. Re: Examples   Reply   Report abuse  
Picture of Ole Ole - 2010-07-22 13:56:55 - In reply to message 2 from Ole
You see, the load method checks the date of the file you give it (the "modified" timestamp), to see if it's been longer than $yourSecondsAttribute since the file was modified.

If it has been longer than you specified in the load method since the file was modified, then your cache is "invalid" (older than you want it to be) and ::load returns ===false.

This means you should regenerate your data and resave it to the cache file again, so that the timestamp for modified on that file will be "touched" and thereby updated.
From that moment your file is "fresh" until x-seconds has passed since file creation / modification. You specify TimeToLive in seconds on the load method the next time you try to get your cached data.... In reality the TTL is the delta time since modification and your load attempt.

The concept is not so hard really, as i said, quite simple whence you get the hang of it. :)