Redis is not as convenient as mysql. You can only write scripts on your own. The following is the first script of the two small scripts written at work. Find the keys with lottery | and delete them all. | print them out? Php $ redisnewRedis (); # instantiate the redis class $ redis-connect (127.0.0.1); # connect to the server $ m $ redis-keys (
Redis is not as convenient as mysql. You can only write scripts on your own. The following is the first script of the two small scripts written at work. Find the keys with lottery | and delete them all. | print them out? Php $ redis = new Redis (); # instantiate the redis class $ redis-connect ('2017. 0.0.1 '); # connect to the server $ m = $ redis-keys ('
Redis is not as convenient as mysql. You can only write scripts on your own. Below are two small scripts written at work
In the first script, find the keys with lottery | and delete them all. | print them out.
Connect ('2017. 0.0.1 '); # connect to the server $ m = $ redis-> keys ('lottery | *'); print_r ($ m ); foreach ($ m as $ key =>$ value) {// $ redis-> del ($ value) ;}$ redis-> close (); # close the connection?>
The Second Script sets several key values and prints them out.
Connect ('2017. 0.0.1 '); # connect to the server // provide a set of user IDs, activity IDs, and qualification IDs for ($ I = 1; $ I <10; $ I ++) {$ redis-> set ('lottery | 7 | cust_id :'. $ I. '| grant', 27) ;}for ($ I = 1; $ I <10; $ I ++) {$ tmp = $ redis-> get ('lottery | 7 | cust_id :'. $ I. '| grant'); echo $ tmp; echo PHP_EOL;} $ redis-> close (); # close the connection?>