Auth_OpenID_MemcachedStore
extends Auth_OpenID_OpenIDStore
in package
This is a memcached-based store for OpenID associations and nonces.
As memcache has limit of 250 chars for key length, server_url, handle and salt are hashed with sha1().
Most of the methods of this class are implementation details. People wishing to just use this store need only pay attention to the constructor.
Table of Contents
- $compress : int
- $connection : Memcache
- __construct() : mixed
- Initializes a new {@link Auth_OpenID_MemcachedStore} instance.
- associationKey() : string
- Memcache key is prefixed with 'openid_association_' string.
- associationServerKey() : string
- Memcache key is prefixed with 'openid_association_' string.
- cleanup() : array<string|int, mixed>
- Shortcut for cleanupNonces(), cleanupAssociations().
- cleanupAssociations() : int
- Remove expired associations from the store.
- cleanupNonces() : int
- Remove expired nonces from the store.
- getAssociation() : Auth_OpenID_Association|null
- Read association from memcached. If no handle given and multiple associations found, returns latest issued
- removeAssociation() : bool|mixed
- Immediately delete association from memcache.
- reset() : mixed
- Removes all entries from the store; implementation is optional.
- storeAssociation() : mixed
- Store association until its expiration time in memcached.
- supportsCleanup() : mixed
- Report that this storage doesn't support cleanup
- useNonce() : bool
- Create nonce for server and salt, expiring after $Auth_OpenID_SKEW seconds.
Properties
$compress
private
int
$compress
= 0
$connection
private
Memcache
$connection
Methods
__construct()
Initializes a new {@link Auth_OpenID_MemcachedStore} instance.
public
__construct(Memcache $connection[, bool $compress = false ]) : mixed
Just saves memcached object as property.
Parameters
- $connection : Memcache
-
Memcache connection resource
- $compress : bool = false
Return values
mixed —associationKey()
Memcache key is prefixed with 'openid_association_' string.
public
associationKey(string $server_url[, null $handle = null ]) : string
Parameters
- $server_url : string
- $handle : null = null
Return values
string —associationServerKey()
Memcache key is prefixed with 'openid_association_' string.
public
associationServerKey(string $server_url) : string
Parameters
- $server_url : string
Return values
string —cleanup()
Shortcut for cleanupNonces(), cleanupAssociations().
public
cleanup() : array<string|int, mixed>
This method is not called in the normal operation of the library. It provides a way for store admins to keep their storage from filling up with expired data.
Return values
array<string|int, mixed> —cleanupAssociations()
Remove expired associations from the store.
public
cleanupAssociations() : int
This method is not called in the normal operation of the library. It provides a way for store admins to keep their storage from filling up with expired data.
Return values
int —the number of associations expired.
cleanupNonces()
Remove expired nonces from the store.
public
cleanupNonces() : int
Discards any nonce from storage that is old enough that its timestamp would not pass useNonce().
This method is not called in the normal operation of the library. It provides a way for store admins to keep their storage from filling up with expired data.
Return values
int —the number of nonces expired
getAssociation()
Read association from memcached. If no handle given and multiple associations found, returns latest issued
public
getAssociation(string $server_url[, null $handle = null ]) : Auth_OpenID_Association|null
Parameters
- $server_url : string
- $handle : null = null
Return values
Auth_OpenID_Association|null —removeAssociation()
Immediately delete association from memcache.
public
removeAssociation(string $server_url, string $handle) : bool|mixed
Parameters
- $server_url : string
- $handle : string
Return values
bool|mixed —reset()
Removes all entries from the store; implementation is optional.
public
reset() : mixed
Return values
mixed —storeAssociation()
Store association until its expiration time in memcached.
public
storeAssociation(string $server_url, Auth_OpenID_Association $association) : mixed
Overwrites any existing association with same server_url and handle. Handles list of associations for every server.
Parameters
- $server_url : string
- $association : Auth_OpenID_Association
Return values
mixed —supportsCleanup()
Report that this storage doesn't support cleanup
public
supportsCleanup() : mixed
Return values
mixed —useNonce()
Create nonce for server and salt, expiring after $Auth_OpenID_SKEW seconds.
public
useNonce(string $server_url, int $timestamp, string $salt) : bool
Parameters
- $server_url : string
- $timestamp : int
- $salt : string