tags:

views:

43

answers:

3

Most examples use time-based cache expiration. I'd like to read more about file caches (where the database is called only when there is no file in a given directory). This is for a basic information site with CMS functions made with php/mysql. My searches are returning too many sites on web applications. Adding CMS to the search returns script repositories. I'd appreciate your suggestions.

+2  A: 

It's not hard to write something like this yourself. Use file_exists() to check whether a specific file exists, or glob() how many files matching a given pattern there are.

tdammers
This will be where I will find myself once I get more information on how to describe the solution fitting my needs. However I don't want to rebuild the wheel and would like to find examples of scripts--only I'm not sure what words to search with.
Xtian
A: 

I'm not quite sure what you're looking for.

If you're talking about generating a page (from the CMS) and placing it at the requested URI (so the next request bypasses even the CMS) - it's possible, but you make refreshing the 'cache' a little difficult.

However, what you may be looking for is just a server side cache (as opposed to telling the browser how long to cache a page). Those are usually file or memory based, and if you place the caching mechanism high in the CMS flow (perhaps where it processes the requests), you'll be caching a large portion of page creation.

Some cache libraries let you set an unlimited lifetime (for example Zend_Cache), leaving the cache maintenance up to you. That may be what you're looking for.

Tim Lytle
ok. Let me clarify one point. The CMS is for the Site Admin, not the public. A public request by design bypasses the CMS. And you're on the right track with file based (not memory). If this helps clarify, do recommend finer terms to use in my search--specifically in the Zend area.
Xtian
+1  A: 

I use a page build system...

Each page created is given a guid - when a request comes in for the page check to see if a file in the cache named GUID.xxx serve it if not build the page and cache.

On editing a page (or if its expiration has passed) delete the file from the cache.

You can elaborate at will as to how the expiration is determined/administered and what protions of the page to cache and which to allow dynamic builds per request...

ToonMariner
I imagine the GUID would assist my existing pages bypass executing the code with this check. Note, there is no expiration of these files. They exist until updated by the Site Admin.
Xtian