I would like to cache the result of a single php file (for a few minutes). Having read a few articles, this seems pretty easy, e.g. following http://www.addedbytes.com/articles/caching-output-in-php/
However, at the end of http://simas.posterous.com/php-data-caching-techniques, the author says that file locking should be done and I cannot see locking in any examples online. Is this required? How should I do it?
Thanks a lot!
We use Nette's NSafeStream class for this - it provides thread safe file access:
You don't need to use rest of the framework, you can use just this class.