The UserAgent Storage Interface - Zend_Http
The UserAgent Storage Interface
Because discovering and identifying mobile device capabilities can involve a number of resources, it's often useful to identify the capabilities on the first visit, and cache it for subsequent visits.
The Zend_Http_UserAgent_Storage interface provides a simple definition for defining storage adapters capable of persisting definitions. By default, a Session storage adapter is used, which persists the data in a Zend_Session_Namespace instance.
The interface provides simply the ability to read from, write to, test for, and clear data in the persistence backend.
- interface Zend_Http_UserAgent_Storage
- public function isEmpty();
- public function read();
- public function write($contents);
- public function clear();
By default, the Zend_Http_UserAgent_Storage_Session adapter is utilized. That adapter writes to a unique Zend_Session_Namespace for the given user.
See the individual storage adapters for configuration options. Most adapters will accept an array or object as an argument to the constructor, and the UserAgent class allows passing an array of options.
Test whether ornot the storage adapter has an entry. Returns true if the storage is currently unpopulated.
Reads data from storage; the data will be serialized PHP.
Write a serialized string to the storage engine.
Should empty the storage; calling isEmpty() following a clear() operation should return true.