SUMMARY: CONSTR | METHOD | DETAIL: CONSTR | METHOD |
Note: This implementation does not provide interfaces for user authorization/authentication. The intent is to outsource such functionality to the application level, which can populate and retrieve attributes as needed, and apply any encryption or privileges in an application specific manner. Future releases may provide stock objects providing common auth&auth functionality.
Note2: The default implementation does not support Set-Cookie2/Cookie2 HTTP headers.
Copyright© 2006, Dean Arnold, Presicient Corp., USA
All rights reserved.
Licensed under the Academic Free License version 2.1, as specified in the License.txt file included in this software package, or at OpenSource.org.
Unless otherwise noted, $self
is the object instance variable.
Constructor Summary |
---|
new($cache, $id, $timeout, $dough, $expires)
Uses input ID, Inactivity timeout, cookie "dough" and expiration timestamp to create a new session context |
open($id, $cache)
Uses input identifier to load a session context from persistent storage |
Method Summary |
---|
close()
Closes this session and removes it from the parent SessionCache |
cookieSent()
Called to indicate that the cookie has been sent to the client |
getAttribute($name)
Returns the object bound with the specified name |
getAttributeNames()
Returns the list of attributes bound to this session |
getCookie()
Returns this session's cookie |
getCreationTime()
Returns the creation time of this session as a fractional number |
getExpiration()
Get expiration on this session |
getID()
Returns the unique ID time of this session NOTE: As a read operation on a static value, no lock is required |
getLastAccessedTime()
Returns the last time the client sent a request for this session |
getMaxInactiveInterval()
Returns the last time the client sent a request for this session |
isInactive()
Has this session timed out ? |
isNew()
Returns true if the cookie for the session has not yet been sent to the client |
removeAttribute($name)
Removes the object bound to the specified name from this session |
setAttribute($name, $value)
Set an attribute on this session, using the name specified |
setExpiration($expires)
Set expiration on this session |
setLastAccessedTime()
Set the last time the client sent a request for this session |
setMaxInactiveInterval($timeout)
Set the max inactivity interval, in seconds, for this session |
Constructor Details |
---|
open($id, $cache)
NOTE: this default implementation simply returns undef, as it does not use persistent storage
$id
- unique identifier for the session to be recovered
$cache
- parent SessionCache object
new($cache, $id, $timeout, $dough, $expires)
$cache
- (required) parent SessionCache object
$id
- (optional) unique identifier for the session; default is generated from
an internal integer generator
$timeout
- (optional) max inactivity timeout; default is 10 minutes
$dough
- (optional) any information to be included in the session cookie;
the $id will be prepended to this information
$expires
- (optional) RFC1123 formatted cookie expiration date string, or 'Never'; default
is single session (nonpersistent)
Method Details |
---|
close()
cookieSent()
Note: Subclasses which implement open()
should
already set this flag when a session is successfully recovered.
getAttribute($name)
$name
- name of attribute to retrieve
getAttributeNames()
getCookie()
getCreationTime()
NOTE: As a read operation on a static value, no lock is required.
getExpiration()
getID()
NOTE: As a read operation on a static value, no lock is required.
getLastAccessedTime()
getMaxInactiveInterval()
isInactive()
isNew()
removeAttribute($name)
$name
- name of attribute to remove
setAttribute($name, $value)
NOTE: Since Session objects are threads shared, their attributes hash is also threads::shared, which means that any non-scalar values to be assigned to an attribute must also be threads::shared.
$name
- name of attribute to set
$value
- value of the attribute to set
setExpiration($expires)
$expires
- RFC1123 expiration timestamp
setLastAccessedTime()
setMaxInactiveInterval($timeout)
$timeout
- inactivity interval in seconds