redis php common operations

class the Redis the extends BaseController 
{ 
        public  function index () {
               key operation 
          P ( $ R & lt -> EXISTS ( "String" )); 
          P ( $ R & lt -> the rename ( "NAME5", "NameX")); // change the key name 
          the p-( $ r -> of the type ( "name6" )); 

            the p-( $ r -> ttl ( "name5")); // expiration time 
            the p-( $ r -> The expire ( "name5", "7900")) ; // specify an expiration time of 

            the p-( $ r -> del ( "name1","name2","name3")); //Delete 
            p ( $ r -> flushDB ()); // delete the current library 
            p ( $ r -> flushAll ()); // delete all the libraries 
            p ( $ r -> dbsize ()); // current number 
            p ( R & lt $ -> sELECT (0)); // select library 
            P ( $ R & lt -> move ( "name7",. 1)); // move to another key database 

    $ R & lt = $ the this -> R & lt;
            $ R & lt - > SET ( "String", "VALUE1" );
           // $ R-> MSET ([ 'mstring1' => 'mstring1', ', string2' => 'mstring2']);

          p($r->get("string"));
          // P (R- $> GET ( "mstring1")); 

          P ( $ R & lt -> LPUSH ( "List", "Class 1", "Class 2", "class. 3" )); 
          P ( R & lt $ -> Lrange ( 'List', 0, -1)); // return all the data, an array 

          echo "set: <br>" ; 
          P ( $ R & lt -> Sadd ( "List", "List1", "List2", "list3" )); 
          P ( $ R & lt -> sMembers ( "List" )); 

          P ( $ R & lt -> HSET ( "the hash", "Hkey1", "Hvalue1" )); 
          P ( $ R & lt -> hSet ( "hash","Hkey2","Hvalue2"));

         p($r->hGetAll("hash"));

         p($r->zAdd('zYouxvJihe','100',"1"));
         p($r->zAdd('zYouxvJihe','300',"4"));
         p($r->zAdd('zYouxvJihe','400',"2"));
         p($r->zAdd('zYouxvJihe','200',"3"));

           p($r->zRangeByScore('zYouxvJihe','0','4'));


            for($i=1;$i<20000;$i++){
                echo "<br>";
                echo $r->get("key".$i);
                echo "<br>";
            } 
     $ M = $ the this -> m;
           $ m -> addServer (); // add to a server connection pool memcache 
          $ m -> SET ( "AA", "AAA", MEMCACHE_COMPRESSED, 3600 );
           $ m - > the delete ( "AA"); // remove a key from the server 
          $ m -> flush (); // all cleaned delete the stored key 
          the p-( $ m -> GET ( "AA")); // acquiring key values 
          $ m -> Close (); 


        $ m = $ the this -> m;
         $ m -> the flush (); 

        } 
        public function mongo(){

             $m = new MongoDB\Driver\Manager("mongodb://localhost:27017");
             p($m);



        }
}

 

Guess you like

Origin www.cnblogs.com/finddata/p/11007406.html
Recommended