cvs: pear /Cache/Container file.php
| From: | Christian Stocker | Date: | Wed, 19 Feb 2003 09:57:11 +0000 |
| Subject: | cvs: pear /Cache/Container file.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-8953@lists.php.net to get a copy of this message | ||
chregu Wed Feb 19 04:57:11 2003 EDT
Modified files:
/pear/Cache/Container file.php
Log:
add max_userdata_linelength as optional parameter for file-container, if
longer userdata entries than 256 chars is needed.
Index: pear/Cache/Container/file.php
diff -u pear/Cache/Container/file.php:1.11 pear/Cache/Container/file.php:1.12
--- pear/Cache/Container/file.php:1.11 Sat Jan 4 06:54:46 2003
+++ pear/Cache/Container/file.php Wed Feb 19 04:57:11 2003
@@ -16,7 +16,7 @@
// | Sebastian Bergmann <sb@sebastian-bergmann.de> |
// +----------------------------------------------------------------------+
//
-// $Id: file.php,v 1.11 2003/01/04 11:54:46 mj Exp $
+// $Id: file.php,v 1.12 2003/02/19 09:57:11 chregu Exp $
require_once 'Cache/Container.php';
@@ -24,7 +24,7 @@
* Stores cache contents in a file.
*
* @author Ulf Wendel <ulf.wendel@phpdoc.de>
-* @version $Id: file.php,v 1.11 2003/01/04 11:54:46 mj Exp $
+* @version $Id: file.php,v 1.12 2003/02/19 09:57:11 chregu Exp $
*/
class Cache_Container_file extends Cache_Container {
@@ -81,6 +81,19 @@
*/
var $total_size = 0;
+
+ /**
+ * Max Line Length of userdata
+ *
+ * If set to 0, it will take the default
+ * ( 1024 in php 4.2, unlimited in php 4.3)
+ * see http://ch.php.net/manual/en/function.fgets.php
+ * for details
+ *
+ * @var int
+ */
+ var $max_userdata_linelength = 257;
+
/**
* Creates the cache directory if neccessary
*
@@ -88,7 +101,7 @@
*/
function Cache_Container_file($options = '') {
if (is_array($options))
- $this->setOptions($options, array_merge($this->allowed_options,
array('cache_dir', 'filename_prefix','fileLocking')));
+ $this->setOptions($options, array_merge($this->allowed_options,
array('cache_dir', 'filename_prefix', 'max_userdata_linelength')));
clearstatcache();
if ($this->cache_dir)
@@ -128,7 +141,11 @@
// 2nd line: user data
// 3rd+ lines: cache data
$expire = trim(fgets($fh, 12));
- $userdata = trim(fgets($fh, 257));
+ if ($this->max_userdata_linelength == 0 ) {
+ $userdata = trim(fgets($fh));
+ } else {
+ $userdata = trim(fgets($fh, $this->max_userdata_linelength));
+ }
$cachedata = $this->decode(fread($fh, filesize($file)));
// Unlocking