Quickstart and Examples
PHP Manual

Setup

The plugin is implemented as a PHP extension. See also the installation instructions to install the » mysqlnd_memcache extension.

Compile or configure the PHP MySQL extension (API) (mysqli, PDO_MYSQL, mysql) that you plan to use with support for the mysqlnd library. mysqlnd_memcache is a plugin for the mysqlnd library. To use the plugin with any of the PHP MySQL extensions, the extension has to use the mysqlnd library.

The mysqlnd_memcche PHP extension depends on the memcached extension. Refer to the according installation instructions for installing that module.

Then, load this extension into PHP and activate the plugin in the PHP configuration file using the PHP configuration directive named mysqlnd_memcache.enable.

Przykład #1 Enabling the plugin (php.ini)

; On Windows the filename is php_mysqnd_memcache.dll
extension=mysqlnd_memcache.so
mysqlnd_memcache.enable=1

Follow the instructions given in the MySQL Reference Manual on installing the Memcache plugins for the MySQL server. Activate the plugins and configure the Memcache access to SQL tables.

For all future examples it is assumed that you have created a SQL table like the following and configured Memcache access to it.

Przykład #2 SQL table used for the Quickstart

CREATE TABLE test(
  id CHAR(16),
  f1 VARCHAR(255),
  f2 VARCHAR(255),
  f3 VARCHAR(255),
  flags INT NOT NULL,
  cas_column INT,
  expire_time_column INT,
  PRIMARY KEY(id)
  ) ENGINE=InnoDB;

INSERT INTO test (id, f1, f2, f3) VALUES (1, 'Hello', 'World', '!');
INSERT INTO test (id, f1, f2, f3) VALUES (2, 'Lady', 'and', 'the tramp');

INSERT INTO innodb_memcache.containers(
  name, db_schema, db_table, key_columns, value_columns, 
  flags, cas_column, expire_time_column, unique_idx_name_on_key)
VALUES (
  'plugin_test', 'test', 'test', 'id', 'f1,f2,f3',
  'flags', 'cas_column', 'expire_time_column', 'PRIMARY KEY');


Quickstart and Examples
PHP Manual