Use NoSQL in MySQL
First of all, MySQL only supports memcached with NoSQL since 5.6. Today this version is not yet updated in linux repositories and must be installed manually, especially on servers for example. MySQL --version
(ubuntu) - 5.5.38; (RedHat Server) 5.1
You must also install libevent-dev, for example:
The hacks are still needed and you must install the memcache interface plugin for MySQL located in $MYSQL_HOME/share
.
I found a well explained post on how to install and try: http://chipersoft.com/p/MySQL-via-Memcache/
Due to its young state, it is not for production servers.
Use it in PHP easy, because the memcache module is native to PHP, when you have installed php5-cli
, and php5-memcache
:
<?php
$memcache = new Memcache;
if (!$memcache->connect('localhost', 11211)) throw new Exception("Could not connect");
if (!$memcache->set('bar', 'John|Smith')) throw new Exception("Could not store value");
$memcache->get('@@aaa'); //switch containers
$result = $memcache->get('AA');
var_dump($result);
Conclusion , this method allows you to work with MySQL and NoSQL at the same time. Memcache offers a fast NoSQL way to retrieve and manipulate data in a different way than SQL.
Edit: Another helpful link is Tony Darnell's post
source to share