PHP Classes

Cache output and objects: Cache the output of PHP scripts in files

Recommend this page to a friend!
  Info   View files View files (11)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 67%Total: 3,514 This week: 1All time: 952 This week: 560Up
Version License PHP version Categories
cache 1.0Custom (specified...4.2Cache, Templates
Description 

Author

This class can be used to cache the output of PHP scripts in files.

It checks if a given cache file exists and is updated. If it is updated, it outputs the cached content. Otherwise it starts capturing the output of the current script.

When the script is done outputting the content to be cached, it should call the class again to check the cache. Then the class updates the captured output.

The class may cache nested scripts that output several blocks of content stored in different cached files and with eventually different expiration times.

This package also comes with a plug-in to cache output of pages generated with Smarty templates.

The class may also cache the serialized values of objects and other types of variables.

Picture of n/a
Name: n/a <contact>
Classes: 2 packages by
Country: Croatia Croatia
Age: 41
All time rank: 6761 in Croatia Croatia
Week rank: 416 Up3 in Croatia Croatia Down

Details

Cache - cache php output and objects This class can cache php text output and objects to files. Constructor for cache blocks is very simple and it requires only one "where" loop (see examples for details). You can also nest multiple blocks, with different expiration times. Cache class also includes easy to use Smarty plugin. Basic PHP syntax: while($cache->save("cache.sample.tmp",60)) { echo("put some code here!"); } Basic Smarty syntax: {cache file="cache.sample.tmp" time="60"} put some code here! {/cache} Dragan Bosnjak http://wreza.bloger.hr

  Files folder image Files  
File Role Description
Files folder imagesmarty (2 files)
Plain text file cache.php Class Main file
Accessible without login Plain text file test_01_hello_world.php Example Hello World
Accessible without login Plain text file test_02_nested.php Example Example of nested blocks
Accessible without login Plain text file test_03_objects.php Example Caching objects
Accessible without login Plain text file test_04_quotes.php Example Test of serialization with special characters
Accessible without login Plain text file test_05_benchmark.php Example Benchmark example
Accessible without login Plain text file test_06_smarty.php Example Smarty plugin example
Accessible without login Plain text file license.txt Lic. License file
Accessible without login Plain text file readme.txt Doc. Read me

  Files folder image Files  /  smarty  
File Role Description
  Accessible without login Plain text file block.cache.php Aux. Smarty plugin
  Accessible without login Plain text file test_06_smarty.tpl Data Templage for smarty plugin example

 Version Control Unique User Downloads Download Rankings  
 0%
Total:3,514
This week:1
All time:952
This week:560Up
User Ratings User Comments (1)
 All time
Utility:87%StarStarStarStarStar
Consistency:85%StarStarStarStarStar
Documentation:75%StarStarStarStar
Examples:80%StarStarStarStarStar
Tests:-
Videos:-
Overall:67%StarStarStarStar
Rank:430
 
does not work anymore
13 years ago (Alexander Garzon)
25%StarStar