content_image/733605.jpg content_image/733606.jpg
There are other methods to test SASL authentication with memcached , but the method described above is the most straightforward. 

## 15.20.6 Writing Applications for the InnoDB memcached Plugin 

Typically, writing an application for the InnoDB memcached  plugin involves some degree of rewriting or adapting existing code that uses MySQL or the memcached  API. 

•With the daemon_memcached  plugin, instead of many traditional memcached  servers running on low- powered machines, you have the same number of memcached  servers as MySQL servers, running on relatively high-powered machines with substantial disk storage and memory. You might reuse some existing code that works with the memcached  API, but adaptation is likely required due to the different server configuration. 

•The data stored through the daemon_memcached  plugin goes into VARCHAR , TEXT , or BLOB  columns, and must be converted to do numeric operations. You can perform the conversion on the application side, or by using the CAST()  function in queries. 

•Coming from a database background, you might be used to general-purpose SQL tables with many columns. The tables accessed by memcached  code likely have only a few or even a single column holding data values. 

•You might adapt parts of your application that perform single-row queries, inserts, updates, or deletes, to improve performance in critical sections of code. Both queries (read) and DML (write) operations can be substantially faster when performed through the InnoDB memcached  interface. The performance improvement for writes is typically greater than the performance improvement for reads, so you might focus on adapting code that performs logging or records interactive choices on a website. 

The following sections explore these points in more detail. 

## 15.20.6.1 Adapting an Existing MySQL Schema for the InnoDB memcached Plugin 

Consider these aspects of memcached  applications when adapting an existing MySQL schema or application to use the daemon_memcached  plugin: 

• memcached  keys cannot contain spaces or newlines, because these characters are used as separators in the ASCII protocol. If you are using lookup values that contain spaces, transform or hash them into values without spaces before using them as keys in calls to add() , set() , get() , and so on. Although theoretically these characters are allowed in keys in programs that use the binary protocol, you should restrict the characters used in keys to ensure compatibility with a broad range of clients. 

•If there is a short numeric primary key column in an InnoDB  table, use it as the unique lookup key for memcached  by converting the integer to a string value. If the memcached  server is used for multiple applications, or with more than one InnoDB  table, consider modifying the name to ensure that it is unique. For example, prepend the table name, or the database name and the table name, before the numeric value. 

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

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

## Note 

The daemon_memcached  plugin supports inserts and reads on mapped InnoDB tables that have an INTEGER  defined as the primary key. 

•You cannot use a partitioned table for data queried or stored using memcached . 

•The memcached  protocol passes numeric values around as strings. To store numeric values in the underlying InnoDB  table, to implement counters that can be used in SQL functions such as SUM()  or AVG() , for example: 

