Php-redis Four of Chinese documents

Source: Internet
Author: User
This article is the fourth part of Php-redis Chinese document, the need for friends can refer to.

This article is the fourth part of Php-redis Chinese document, the need for friends can refer to.

GetRange (the method does not exist) returns the character $redis->set (' key ', ' string value ') between the start and end of the string named key, and the $redis->getrange (' key ', 0, 5 ); $redis->getrange (' key ',-5,-1); SetRange (the method does not exist) change key in the string between the start and end characters as Value$redis->set (' key ', ' Hello World '); $redis->setrange (' key ', 6 , "Redis"); $redis->get (' key '); Strlen gets the string length of the key $redis->strlen (' key '); Getbit/setbit returns 2 binary information Zset (sorted set) operation related Zadd (key, Score, member): add element Zset for sorting to Member,score named key. If the element already exists, the order of the element is updated according to score. $redis->zadd (' key ', 1, ' val1 '), $redis->zadd (' key ', 0, ' val0 '), $redis->zadd (' key ', 5, ' val5 '); $redis Zrange (' key ', 0,-1); Array (val0, Val1, VAL5) Zrange (key, Start, End,withscores): Returns all elements of index from start to end in Zset with the name key (the element has been sorted by score from small to large) $ Redis->zadd (' Key1 ', 0, ' val0 '), $redis->zadd (' Key1 ', 2, ' val2 '), $redis->zadd (' Key1 ', ' val10 '); $redis- >zrange (' Key1 ', 0,-1); With scores $redis->zrange (' Key1 ', 0,-1, true); ZDelete, Zremzrem (Key, member): Delete the element in the Zset named Key member$redis->zadd (' key ', 0, ' Val0 '); $redis->zadd (' key ', 2, ' val2 '); $redis->zadd (' key ', ' Val10 '); $redis->zdelete (' key ', ' Val2 '); $ Redis->zrange (' key ', 0,-1); Zrevrange (Key, Start, End,withscores): Returns all the elements of index from start to end in the Zset with the name key (the element has been sorted by score from large to small). Withscores: Whether output Socre value, default false, does not output $redis->zadd (' key ', 0, ' val0 '); $redis->zadd (' key ', 2, ' val2 '); $redis->zadd (' key ', ' Val10 '); $redis->zrevrange (' key ', 0,-1); With scores $redis->zrevrange (' key ', 0,-1, true); Zrangebyscore, Zrevrangebyscore$redis->zrangebyscore (key, star, end, Array (withscores, limit)); Returns all elements of score >= star and score <= end in Zset named Key Zcount$redis->zcount (key, star, end); Returns Zset score with name key The number of all elements of star and score <= end Zremrangebyscore, Zdeleterangebyscore$redis->zremrangebyscore (' key ', star, end); Remove all elements of score >= star and score <= end in Zset named Key, return the number of deletions zsize, Zcard returns the number of all elements of Zset with the name Key Zscore$redis->zscore ( Key, Val2); Returns the score Zrank, Zrevrank$redis->zrevrank (Key, Val) of the element Val2 in Zset with the name key;The Zset with the name key (the element has been sorted by score from small to large), rank of the Val element (that is, index, starting at 0), and returns "NULL" if there is no Val element. Zrevrank is from large to small sort zincrby$redis->zincrby (' key ', increment, ' member '), if element Zset already exists in member named Key, The score of the element increases increment; otherwise, the element is added to the collection, and its score value is increment zunion/ Zinter parameter keyoutputarrayzsetkeysarrayweightsaggregatefunction either "SUM", "MIN", or "MAX": Defines the behaviour to use O N duplicate entries during the zunion. Sets and intersections for N Zset, and saves the final collection in Dstkeyn. For the score of each element in a collection, multiply the weight parameter for the aggregate operation before doing it. If weight is not provided, the default is 1. The default aggregate is sum, that is, the score of the elements in the result set is the value of the sum operation for all the corresponding elements of the collection, while Min and Max means that the score of the elements in the result set are the minimum and maximum values in the corresponding elements of all the collections.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.