Source for file CacheLite.php
Documentation is available at CacheLite.php
* @uses OpenID_Store_Interface
* @author Bill Shupp <hostmaster@shupp.org>
* @author Rich Schumacher <rich.schu@gmail.com>
* @copyright 2009 Bill Shupp, Rich Schumacher
* @license http://www.opensource.org/licenses/bsd-license.php FreeBSD
* @link http://pearopenid.googlecode.com
require_once 'Cache/Lite.php';
require_once 'OpenID/Store/Interface.php';
* PEAR Cache_Lite driver for storage. This is the default driver used.
* @uses OpenID_Store_Interface
* @author Bill Shupp <hostmaster@shupp.org>
* @author Rich Schumacher <rich.schu@gmail.com>
* @copyright 2009 Bill Shupp, Rich Schumacher
* @license http://www.opensource.org/licenses/bsd-license.php FreeBSD
* @link http://pearopenid.googlecode.com
* Default options for Cache_Lite
'hashedDirectoryLevel' =>
2
* Sub-directory storage for each type of store
self::TYPE_ASSOCIATION =>
'association',
self::TYPE_DISCOVER =>
'discover',
self::TYPE_NONCE =>
'nonce'
* Instantiate Cache_Lite. Allows for options to be passed to Cache_Lite.
* @param array $options Options for Cache_Lite constructor
$this->cache =
new Cache_Lite($options);
* Gets an OpenID_Assocation instance from storage
* @param string $uri The OP endpoint URI to get an association for
* @param string $handle The handle if available
* @return OpenID_Association
* Stores an OpenID_Association instance. Details (such as endpoint url and
* expiration) are retrieved from the object itself.
* @param OpenID_Association $association Instance of OpenID_Association
$this->setOptions(self::TYPE_ASSOCIATION, $association->expiresIn);
// Store URI + Handle based key
md5($association->uri .
$association->assocHandle));
* Deletes an association from storage
* @param string $uri OP Endpoint URI
* Gets an OpenID_Discover object from storage
* @param string $identifier The normalized identifier that discovery was
* @return OpenID_Discover
* Stores an instance of OpenID_Discover
* @param OpenID_Discover $discover Instance of OpenID_Discover
* @param int $expire How long to cache it for, in seconds
public function setDiscover(OpenID_Discover $discover, $expire =
null)
* Deletes a cached OpenID_Discover object
* @param string $identifier The Identifier
return $this->cache->remove($key);
* Common method for creating a cache key based on the normalized identifier
* @param string $identifier User supplied identifier
* @return string md5 of the normalized identifier
* Gets a nonce from storage
* @param string $nonce The nonce itself
* @param string $opURL The OP Endpoint URL it was used with
public function getNonce($nonce, $opURL)
return $this->cache->get($key);
* Stores a nonce for an OP endpoint URL
* @param string $nonce The nonce itself
* @param string $opURL The OP endpoint URL it was associated with
public function setNonce($nonce, $opURL)
* Deletes a nonce from storage
* @param string $nonce The nonce to delete
* @param string $opURL The OP endpoint URL it is associated with
* Common method for creating a nonce key based on both the nonce and the OP
* @param string $nonce The nonce
* @param string $opURL The OP endpoint URL it is associated with
* @return string Cache key
return md5('OpenID.Nonce.' .
$opURL .
$nonce);
* Sets options for Cache_Lite based on the needs of the current method.
* Options set include the subdirectory to be used, and the expiration.
* @param string $key The sub-directory of the cacheDir
* @param string $expire The cache lifetime (expire) to be used
protected function setOptions($key, $expire =
null)
$this->cache->setOption('cacheDir', $cacheDir);
$this->cache->setOption('lifeTime', $expire);
* Make sure the given sub directory exists. If not, create it.
* @param string $dir The full path to the sub director we plan to write to
Documentation generated on Tue, 15 Dec 2009 19:00:51 -0800 by phpDocumentor 1.4.3