I took a look at your proposed architecture.
A couple of items. By limiting yourself and your approach to a single local custom memcache server instance tied to the database table you are complicating other developers designs when they will be trying to implement a service against this memcached table.
First consider that almost every implementation of memcache in a service chain has as part of its get data from memcache server method, a statement that says if data doesn't exist in memcache retrieve from underlying data source and store into memcache.
Second, if you are planning for crud operations in memcache to control the contents of the innodb table then that means you are creating a custom version of memcache that needs to talk to the attached table, additionally it sounds as though you are planning to use a custom memcache server instance per table, one table per instance per port. Furthermore you would be allowing out of memory issues to reduce the contents of the table when most users would expect the rows to be persisted in the DB.
Most architects wanting to implement a database against a memcache server either already has one or more memcache servers in house, or is expecting the same behavior out of this plugin as the default memcache server provides.
My approach would be as follows:
Consider for a moment how the federated table engine presents itself to users.
There is a custom table containing config options in the mysql database, and there is a custom sql command, create server that enters data into the mysql.servers table.
I personally (despite the fact I can't really write the necessary code) would present 3 tables in the mysql database the first would be a memcache_servers table as follows:
ServerAddress Varchar(255) not null primary key,
ServerPort int unsigned not null,
ServerProtocol ENUM('TCP','UDP') not null DEFAULT 'TCP',
RetryCount int unsigned not null DEFAULT 3,
RetryDelay int unsigned not null DEFAULT 500 COMMENT 'milliseconds'
The second would be a table called memcache_pools which should be as follows:
ServerPoolName varchar(255) not null primary key,
DB_Table_Key_Sep varchar(16) not null,
PriColumn_Key_Sep varchar(16) not null
And the third would be a table called memcache_pool_servers which should be as follows:
ServerPoolName varchar(255) not null primary key,
ServerAddress Varchar(255) not null primary key
In addition to these three tables I would have custom sql commands along the lines as follows:
Create memcache_server address port protocol;
Create memcache_pool name dbtablesep pricolkeysep;
Update memcache_pool name add/drop address;
Etc.
Presenting the configuration in this manner would allow for behavior along the lines of:
Alter table name memcache_pool="poolname";
This in conjunction with the transparent after trigger support I mentioned in my earlier comment would allow for some very highly consistent, and flexible behavior.
One of the benefits to this approach is that memcache support on a table becomes table engine agnostic, and can be integrated with an existing memcache server implementation with relative ease, additionally it would allow for some complex behaviors where certain memcache servers can share servers allowing for custom service permissions on the side of the service connecting to the memcache servers. Ie documents can be served to memcache pool 1 and 2 but memcache pool 1 gets user info and pool 2 gets admin info.
Another benefit is that unless the person implementing this plugin desires to put the memcache server on the database server they don't have to.
Furthermore because we are relying on an industry standard for memcache support the implementer will not have to write custom code to support a custom memcache implementation, and you as the person writing the plugin will not have to worry about having a port listener and implementing your own custom memcache, thus making for in theory at least a lighter weight plugin.
Finally this would allow for on the fly additions to memcached table data without server reconfiguration and restarts.
It is unfortunate that this ticket has yet to be addressed. I'd like to use the memcached api to hook PHP sessions into - I can do this on mysql 5.6 but not MariaDB.
To me this feature is critical.