Zend Framework 101: Zend_Session
Other Zend_Session Functionality
In addition to what's been covered so far in this article, there are some other advanced features that can be used with Zend_Session. This section shows introduces you to these features and provides a link for more information about the feature.
Storing Sessions in a Database
By default, PHP stores session data on the filesystem of the server. You can change this so session data is stored in a database. The database must be a connection made using the Zend_Db component. You can then make use of the
Zend_Session_SaveHandler_DbTable
class with the Zend_Session::setSaveHandler()
method.
Tip: If you don't use Zend_Db for accessing your database (or you want to save session data using some other method), you can create your own save handler by implementing the
Zend_Session_SaveHandler_Interface
interface.
Storing session data in your database is useful in a load-balanced environment, where subsequent user requests may be handled by different front-end servers (all sharing the same database server).
For more information on saving session data to the database, refer tohttp://framework.zend.com/manual/en/zend.session.savehandler.dbtable.html.
Session Value and Namespace Expiration
You can make values in a session namespace (or an entire namespace) automatically expire after a set period of time. The time can be measured either in seconds or “hops” (that is, you can make a value only be set for the specified number of subsequent page requests).
For details on automatic expiration of session values refer tohttp://framework.zend.com/manual/en/zend.session.advanced_usage.html#zend.session.advanced_usage.expiration.
No comments:
Post a Comment