cvs: php4 /pear/Cache/Container shm.php

From: Date: Sun, 12 Aug 2001 15:01:42 +0000
Subject: cvs: php4 /pear/Cache/Container shm.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-481@lists.php.net to get a copy of this message
sebastian Sun Aug 12 11:01:42 2001 EDT Modified files: /php4/pear/Cache/Container shm.php Log: Even more whitespace fixes. Index: php4/pear/Cache/Container/shm.php diff -u php4/pear/Cache/Container/shm.php:1.7 php4/pear/Cache/Container/shm.php:1.8 --- php4/pear/Cache/Container/shm.php:1.7 Sun Aug 12 10:54:12 2001 +++ php4/pear/Cache/Container/shm.php Sun Aug 12 11:01:42 2001 @@ -16,7 +16,7 @@ // | Sebastian Bergmann <sb@sebastian-bergmann.de> | // +----------------------------------------------------------------------+ // -// $Id: shm.php,v 1.7 2001/08/12 14:54:12 sebastian Exp $ +// $Id: shm.php,v 1.8 2001/08/12 15:01:42 sebastian Exp $ require_once 'Cache/Container.php'; @@ -29,7 +29,7 @@ * caching algorithm using PHP. * * @author Ulf Wendel <ulf.wendel@phpdoc.de> -* @version $Id: shm.php,v 1.7 2001/08/12 14:54:12 sebastian Exp $ +* @version $Id: shm.php,v 1.8 2001/08/12 15:01:42 sebastian Exp $ * @package Cache */ class Cache_Container_shm extends Cache_Container { @@ -87,7 +87,7 @@ /** * Hash of cache entries * - * Used by the garbage collection to find old entries. + * Used by the garbage collection to find old entries. * * @var array */ @@ -127,9 +127,16 @@ //get SHM and Semaphore handles if (!($this->shm_id = shmop_open($this->shm_key, 'c', $this->shm_perm, $this->shm_size))) - new Cache_Error("Can't open SHM segment '{$this->shm_key}', size '{$this->shm_size}'.", __FILE__, __LINE__); + new Cache_Error("Can't open SHM segment '{$this->shm_key}', size '{$this->shm_size}'.", + __FILE__, + __LINE__ + ); + if (!($this->sem_id = sem_get($this->sem_key, 1, $this->sem_perm))) - new Cache_Error("Can't get semaphore '{$this->sem_key}' using perms '{$this->sem_perm}'.", __FILE__, __LINE__); + new Cache_Error("Can't get semaphore '{$this->sem_key}' using perms '{$this->sem_perm}'.", + __FILE__, + __LINE__ + ); } // end constructor @@ -147,7 +154,10 @@ else $cachedata = $cachedata[$group][$id]; - return array($cachedata['expire'], $cachedata['cachedata'], $cachedata['userdata']); + return array($cachedata['expire'], + $cachedata['cachedata'], + $cachedata['userdata'] + ); } // end func fetch function save($id, $data, $expire, $group, $userdata) { @@ -156,15 +166,14 @@ sem_acquire($this->sem_id); $cachedata = $this->decode(shmop_read($this->shm_id, 0, $this->shm_size)); - $cachedata[$group][$id] = array( - 'expire' => $this->getExpiresAbsolute($expire), - 'cachedata' => $data, - 'userdata' => $userdata, - 'changed' => time() - ); + $cachedata[$group][$id] = array('expire' => $this->getExpiresAbsolute($expire), + 'cachedata' => $data, + 'userdata' => $userdata, + 'changed' => time() + ); if (strlen($newdata = $this->encode($cachedata)) > $this->shm_size) - $cachedata = $this->garbageCollection(time(), $cachedata); + $cachedata = $this->garbageCollection(time(), $cachedata); shmop_write($this->shm_id, $newdata, 0); @@ -232,7 +241,7 @@ sem_release($this->sem_id); $this->entries = array(); - $this->total_size = 0; + $this->total_size = 0; return $cachedata; } // end func garbageCollection @@ -258,7 +267,7 @@ 'id' => $id ); - $this->total_size += $size; + $this->total_size += $size; } return $removed;

« previous php.pear.cvs (#481) next »