I think the mysql udf plugin (https://github.com/Ideonella-sakaiensis/lib_mysqludf_redis) can help you to synchronize data from Mysql to Redis.
example:
DELIMITER $$
CREATE TABLE `my_table` (
id varchar(16) PRIMARY KEY,
text varchar(32)
);
set up a trigger for the table and call redis command by mysql udf
DELIMITER $$
CREATE TRIGGER `after_insert_my_table`
AFTER INSERT ON `my_table` FOR EACH ROW
BEGIN
DO `redis`('redis://@127.0.0.1/0/', 'SET', new.`id`, new.`text`);
END $$
DELIMITER ;
then you can get value by my_table id
mysql> SELECT `redis`('redis://@127.0.0.1/0/', 'GET', <my_table id>)G
*************************** 1. row ***************************
`redis`('redis://@127.0.0.1/0/', 'GET', <my_table id>): {
"out": <my_table text>
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…