Hello, I'm working on a PHP cache library, and I wanted to check in and see what folks thought.
Usually, you have many different front end views that you will want to cache. These may pull from multiple datasources in odd ways. Far away from the front end, there is backend CMS, either a tool like Wordpress or Drupal, or a custom tool. Generally, I find myself managing caches by: 1. Putting the code that generates the cache into the front end, since it is the design that dictates which pieces of information should be grouped together. 2. Putting a very small amount of code in the back end which causes the cache to be deleted on the appropriate CRUD operations. CMS's are complicated enough as they are, and I don't want to clutter them up more then necessary. The hard part is creating the association between the front and back end. What I want to do is to use *tags* to create this association, and to break caches. It works something like this: <?php function an_expensive_operation($arg1, $arg2) { .... } cache_set_dir('/tmp/www/cache'); // this will either run the callback and cache // the return value and output, or just spit // out the output and return value // function cache( $callback, $params, $unique_name, $flags ) {...}; cache( 'an_expensive_operation', array($value1, $value2), 'run_an_expensive_operation_on_the_home_page', array('on_save', 'on_update', 'on_monday') ); // any of these calls will cause the cache to be deleted, // and force the cached function above to be re-run break_cache('run_an_expensive_operation_on_the_home_page'); break_cache('on_save'); break_cache('on_update'); break_cache('on_monday'); break_cache('on_tuesday', 'on_monday'); ?> Does this sound similar to any existing library / tool, either for PHP or for any other platform? Does this sound like a useful library? Thanks for your feedback! Cheers, Patrick -- Patrick May 135 Oak Street New York, NY 11222 +1 (347) 232-5208 [EMAIL PROTECTED] http://www.hexane.org
_______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php