MemcacheService (since version 2.0)
Type Service
Constants
string DEFAULT_HOSTNAME = " 127.0.0.1 "
The default hostname (IP) to connect to the mecache.
integer DEFAULT_PORTNUMBER = 11211
The default port to connect to the memcache.
string PROFILE_PREFIX = " DS. "
the profile prefix which is added to the profile name.
Methods
Description
The memcache service can be used to connect to an memcache and use the operations get, set and delete on cached data.
This service uses the ProfileService to handle als created profiles.
This service uses the ProfileService to handle als created profiles.
Examples
<?php
//create memcache profile
MecacheService::CreateProfile('memcache_profile');
// use the current created memcache profile
MecacheService::Begin('memcache_profile');
// save data with a specific key and set lifetimne to 15 seconds
MecacheService::Save('test', array(1,2,3), 15);
// release current cache profile
MemcacheService::End();
?>
//create memcache profile
MecacheService::CreateProfile('memcache_profile');
// use the current created memcache profile
MecacheService::Begin('memcache_profile');
// save data with a specific key and set lifetimne to 15 seconds
MecacheService::Save('test', array(1,2,3), 15);
// release current cache profile
MemcacheService::End();
?>
Last change 10/13/2009