content_image/789727.jpg content_image/789716.jpg
+----+------------------+------+------+------+ 

4. Return to the telnet session and retrieve the data that you inserted earlier using key BB . 

get BB VALUE BB 10 16 GOODBYE, GOODBYE END quit 

If you shut down the MySQL server, which also shuts off the integrated memcached  server, further attempts to access the memcached  data fail with a connection error. Normally, the memcached  data also disappears at this point, and you would require application logic to load the data back into memory when memcached  is restarted. However, the InnoDB memcached  plugin automates this process for you. 

When you restart MySQL, get  operations once again return the key-value pairs you stored in the earlier memcached  session. When a key is requested and the associated value is not already in the memory cache, the value is automatically queried from the MySQL test.demo_test  table. 

## Creating a New Table and Column Mapping 

This example shows how to setup your own InnoDB  table with the daemon_memcached  plugin. 

1. Create an InnoDB  table. The table must have a key column with a unique index. The key column of the city table is city_id , which is defined as the primary key. The table must also include columns for flags , cas , and expiry  values. There may be one or more value columns. The city  table has three value columns ( name , state , country ). 

<img src='content_image/789727.jpg'>

mysql> CREATE TABLE city ( city_id VARCHAR(32), name VARCHAR(1024), state VARCHAR(1024), country VARCHAR(1024), flags INT, cas BIGINT UNSIGNED, expiry INT, primary key(city_id) ) ENGINE=InnoDB; 

## Note 

There is no special requirement with respect to column names as along as a valid mapping is added to the innodb_memcache.containers  table. 

2. Add an entry to the innodb_memcache.containers  table so that the daemon_memcached  plugin knows how to access the InnoDB  table. The entry must satisfy the innodb_memcache.containers table definition. For a description of each field, see Section 15.20.8, “InnoDB memcached Plugin Internals” . 

mysql> DESCRIBE innodb_memcache.containers; 

<img src='content_image/789716.jpg'>

