We now use the Redis database, although I also understand those get set operation, but finally no time to live, how to cooperate with MySQL database in the Nepal?
Reply to discussion (solution)
Compress the query result set after saving
if ($redis->get (' key ')) {$result = $redis->get (' key '); $result = Unserialize ($result);} else{//Query Database $result = mysql_query ($sql), while ($row = Mysql_fetch_array ()) { $arr [] = $row;} $arr = serialize ($arr); $redis->set (' key ', $arr);}
Not that Redis is better than memcache?
So memcache can store PHP arrays and objects directly, why not Redis?
Compress the query result set after saving
if ($redis->get (' key ')) {$result = $redis->get (' key '); $result = Unserialize ($result);} else{//Query Database $result = mysql_query ($sql), while ($row = Mysql_fetch_array ()) { $arr [] = $row;} $arr = serialize ($arr); $redis->set (' key ', $arr);}
Redis includes string, List, Set, zset, hash data type, look at your data in the application scenario, MC and Redis can be used as a cache, after the data from MySQL, see MC or Redis Application