[PHP-CVS] cvs: php4 /pear/Cache Function.php
sbergmann Fri Mar 2 00:11:18 2001 EDT Modified files: /php4/pear/CacheFunction.php Log: Fixed typo. Index: php4/pear/Cache/Function.php diff -u php4/pear/Cache/Function.php:1.1 php4/pear/Cache/Function.php:1.2 --- php4/pear/Cache/Function.php:1.1Thu Mar 1 23:52:56 2001 +++ php4/pear/Cache/Function.phpFri Mar 2 00:11:17 2001 @@ -15,7 +15,7 @@ // | Authors: Sebastian Bergmann <[EMAIL PROTECTED]> | // +--+ // -// $Id: Function.php,v 1.1 2001/03/02 07:52:56 sbergmann Exp $ +// $Id: Function.php,v 1.2 2001/03/02 08:11:17 sbergmann Exp $ require_once 'Cache.php'; @@ -26,7 +26,7 @@ // create Cache object, if needed if (!is_object($cache)) { -$cache = new Cache(CACHE_CONTAINER, CACHE_CONTAINER_OPTIONS) +$cache = new Cache(CACHE_CONTAINER, CACHE_CONTAINER_OPTIONS); } // get arguments -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/Cache Function.php
sbergmann Fri Mar 2 00:18:35 2001 EDT Modified files: /php4/pear/CacheFunction.php Log: Make it work, hopefully. Index: php4/pear/Cache/Function.php diff -u php4/pear/Cache/Function.php:1.2 php4/pear/Cache/Function.php:1.3 --- php4/pear/Cache/Function.php:1.2Fri Mar 2 00:11:17 2001 +++ php4/pear/Cache/Function.phpFri Mar 2 00:18:35 2001 @@ -15,18 +15,19 @@ // | Authors: Sebastian Bergmann <[EMAIL PROTECTED]> | // +--+ // -// $Id: Function.php,v 1.2 2001/03/02 08:11:17 sbergmann Exp $ +// $Id: Function.php,v 1.3 2001/03/02 08:18:35 sbergmann Exp $ require_once 'Cache.php'; function cached_function_call() { +global $FUNCTION_CACHE_CONTAINER, $FUNCTION_CACHE_CONTAINER_OPTIONS; static $cache; // create Cache object, if needed if (!is_object($cache)) { -$cache = new Cache(CACHE_CONTAINER, CACHE_CONTAINER_OPTIONS); +$cache = new Cache($FUNCTION_CACHE_CONTAINER, +$FUNCTION_CACHE_CONTAINER_OPTIONS); } // get arguments -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/Cache Function.php
sbergmann Fri Mar 2 00:25:13 2001 EDT Modified files: /php4/pear/CacheFunction.php Log: Added PHPDoc doccomments. Index: php4/pear/Cache/Function.php diff -u php4/pear/Cache/Function.php:1.3 php4/pear/Cache/Function.php:1.4 --- php4/pear/Cache/Function.php:1.3Fri Mar 2 00:18:35 2001 +++ php4/pear/Cache/Function.phpFri Mar 2 00:25:12 2001 @@ -15,9 +15,49 @@ // | Authors: Sebastian Bergmann <[EMAIL PROTECTED]> | // +--+ // -// $Id: Function.php,v 1.3 2001/03/02 08:18:35 sbergmann Exp $ +// $Id: Function.php,v 1.4 2001/03/02 08:25:12 sbergmann Exp $ require_once 'Cache.php'; + +/** +* Function_Cache +* +* Purpose: +* +* Caching the result and output of functions. +* +* Example: +* +* require_once "Cache/Function.php"; +* +* function foo($string) +* { +* print $string . ""; +* for($i=1;$i<1000;$i++){} +* return strrev($string); +* } +* +* print cached_function_call("foo", "test"); +* +* Note: +* +* You cannot cache every function. You should only cache +* functions that only depend on their arguments and don't use +* global or static variables, don't rely on database queries or +* files, and so on. +* +* @author Sebastian Bergmann <[EMAIL PROTECTED]> +* @module Function_Cache +* @version $Revision: 1.4 $ +* @access public +*/ + +/** +* Calls a cacheable function or method. +* +* @return mixed $result +* @access public +*/ function cached_function_call() { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/Cache Function.php
sbergmann Fri Mar 2 00:27:43 2001 EDT Modified files: /php4/pear/CacheFunction.php Log: Fixed example. Index: php4/pear/Cache/Function.php diff -u php4/pear/Cache/Function.php:1.4 php4/pear/Cache/Function.php:1.5 --- php4/pear/Cache/Function.php:1.4Fri Mar 2 00:25:12 2001 +++ php4/pear/Cache/Function.phpFri Mar 2 00:27:43 2001 @@ -15,7 +15,7 @@ // | Authors: Sebastian Bergmann <[EMAIL PROTECTED]> | // +--+ // -// $Id: Function.php,v 1.4 2001/03/02 08:25:12 sbergmann Exp $ +// $Id: Function.php,v 1.5 2001/03/02 08:27:43 sbergmann Exp $ require_once 'Cache.php'; @@ -30,11 +30,16 @@ * * require_once "Cache/Function.php"; * +* $FUNCTION_CACHE_CONTAINER = "file"; +* $FUNCTION_CACHE_CONTAINER_OPTIONS = array( +* "cache_dir" => "/tmp/", +* "filename_prefix" => "cache_"); +* * function foo($string) * { -* print $string . ""; -* for($i=1;$i<1000;$i++){} -* return strrev($string); +* print $string . ""; +* for($i=1;$i<1000;$i++){} +* return strrev($string); * } * * print cached_function_call("foo", "test"); @@ -48,7 +53,7 @@ * * @author Sebastian Bergmann <[EMAIL PROTECTED]> * @module Function_Cache -* @version $Revision: 1.4 $ +* @version $Revision: 1.5 $ * @access public */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/Cache Function.php
uw Sat Mar 3 11:17:20 2001 EDT Modified files: /php4/pear/CacheFunction.php Log: Changed the order of the inline module comment and the copyright stuff. Ok, I know this will lead to some discussion. But please let me change it so that PHPDoc works with it. Future version of PHPDoc will be able to handle the other order but this version... I'll redo my changed as well as soon as there is a new PHPDoc version. Index: php4/pear/Cache/Function.php diff -u php4/pear/Cache/Function.php:1.5 php4/pear/Cache/Function.php:1.6 --- php4/pear/Cache/Function.php:1.5Fri Mar 2 00:27:43 2001 +++ php4/pear/Cache/Function.phpSat Mar 3 11:17:20 2001 @@ -1,24 +1,4 @@ http://www.php.net/license/2_02.txt. | -// | If you did not receive a copy of the PHP license and are unable to | -// | obtain it through the world-wide-web, please send a note to | -// | [EMAIL PROTECTED] so we can mail you a copy immediately. | -// +--+ -// | Authors: Sebastian Bergmann <[EMAIL PROTECTED]> | -// +--+ -// -// $Id: Function.php,v 1.5 2001/03/02 08:27:43 sbergmann Exp $ - -require_once 'Cache.php'; - /** * Function_Cache * @@ -51,19 +31,40 @@ * global or static variables, don't rely on database queries or * files, and so on. * -* @author Sebastian Bergmann <[EMAIL PROTECTED]> -* @module Function_Cache -* @version $Revision: 1.5 $ -* @access public +* @author Sebastian Bergmann <[EMAIL PROTECTED]> +* @module Function_Cache +* @modulegroup Function_Cache +* @package Cache +* @version $Revision: 1.6 $ +* @access public */ +// +--+ +// | PHP version 4.0 | +// +--+ +// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | +// +--+ +// | This source file is subject to version 2.0 of the PHP license, | +// | that is bundled with this package in the file LICENSE, and is| +// | available at through the world-wide-web at | +// | http://www.php.net/license/2_02.txt. | +// | If you did not receive a copy of the PHP license and are unable to | +// | obtain it through the world-wide-web, please send a note to | +// | [EMAIL PROTECTED] so we can mail you a copy immediately. | +// +--+ +// | Authors: Sebastian Bergmann <[EMAIL PROTECTED]> | +// +--+ +// +// $Id: Function.php,v 1.6 2001/03/03 19:17:20 uw Exp $ + +require_once 'Cache.php'; + /** * Calls a cacheable function or method. * * @return mixed $result * @access public */ - function cached_function_call() { global $FUNCTION_CACHE_CONTAINER, $FUNCTION_CACHE_CONTAINER_OPTIONS; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]