ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:userguide:learn_caching:memcached

This is an old revision of the document!


Memcached Setup

Memcached provides a controlled, server based memory caching service. The server is reasonably easily configured and installed, but provides a sophisticated caching configuration. PHP support for the library is available through the PHP PEAR memcached library. For largr environments, multiple memcached hosts can be specified.

There are 2 pear modules for connection to a Memcached server, the older PEAR Memcache library and the newer PEAR Memcached library.

  • Windows support is only available for the older Memcache library.
  • ADOdb has only been tested against the older library

Description

This section describes connection to an already configured Memcache server. Information about installation and configuration of Memcached servers can be found here.

Usage

$db = NewADOConnection($driver='mysqli');
/*
* Enable memcache
*/
$db->memCache = true;
/*
* Add one or more servers, for use in distributed systems
*/
$db->memCacheHost = array('192.168.0.78', '192.168.0.79', '192.168.0.80'); 
/*
* Optionally add the server port if it differs from the default
*/
$db->memCachePort = 11211;
/*
* Use 'true' to store the item compressed (uses zlib)
*/
$db->memCacheCompress = false; 
 
/*
* We connect to the database, not the memcache server
*/
$db->Connect('localhost','mysql-user','mysql-password','employees');
v5/userguide/learn_caching/memcached.1459127515.txt.gz · Last modified: 2017/04/21 11:40 (external edit)