PHP Classes

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

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 67%Total: 3,514 All 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: 6771 in Croatia Croatia
Week rank: 180 Up2 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 (11)  
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 (11)  /  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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:3,514
This week:0
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:428
 
does not work anymore
13 years ago (Alexander Garzon)
25%StarStar