Other MIME
Session Cache
Menu


Caching data in the session:

<?php

require_once HORDE_BASE '/lib/SessionCache.php';

// Add an object to the cache
$cacheID SessionCache::putObject($foo);

// Retrieve an object from the cache
$bar SessionCache::getObject($cacheID);

?>

  • The SessionCache class lets you cache a small number of variables (up to 20, by default) in a user's session.
  • Pass in PHP variables; SessionCache will take care of serialization, if necessary.
  • Older variables will be discarded if you go past the maximum cache size, so an alternative method of retrieving the data is also required.