本文为我阅读了 redis参考手册 之后编写,注意 php_redis 和 redis-cli 的区别(主要是返回值类型和参数用法)

Redis的 Set 是 string 类型的无序集合。集合成员是唯一的,这就意味着集合中不能出现重复的数据。

目录:

Set(集合)
SADD SREM SMEMBERS SCARD SMOVE SPOP SRANDMEMBER
SINTER SINTERSTORE SUNION0 SUNIONSTORE SDIFF SDIFFSTORE SISMEMBER

Set(集合)

1、SADD

Redis Sadd 命令将一个或多个成员元素加入到集合中

(1)已经存在于集合的成员元素将被忽略。

(2)假如集合 key 不存在,则创建一个只包含添加的元素作成员的集合。

(3)当集合 key 不是集合类型时,返回一个错误。

注意:在Redis2.4版本以前, SADD 只接受单个成员值。

语法:

  1. redis 127.0.0.1:6379> SADD KEY_NAME VALUE1..VALUEN

返回值: 被添加到集合中的新元素的数量,不包括被忽略的元素。

可用版本:>= 1.0.0

时间复杂度:(N),N是被添加的元素的数量。

具体实例:

  1. <?php
  2. $redis = new redis();
  3. $redis -> connect('127.0.0.1',6379);
  4. $redis -> flushAll();
  5.  
  6. $redis -> sAdd('myset','hello');
  7. $redis -> sAdd('myset','foo');
  8. $redis -> sAdd('myset','hello'); // 已存在的 key 被忽略
  9.  
  10. var_dump($redis -> sMembers('myset'));
  11. //array (size=2)
  12. // 0 => string 'hello' (length=5)
  13. // 1 => string 'foo' (length=3)

2、SREM

Redis Srem 命令用于移除集合中的一个或多个成员元素,不存在的成员元素会被忽略。

当 key 不是集合类型,返回一个错误。

在 Redis 2.4 版本以前, SREM 只接受单个成员值。

语法:

redis 127.0.0.1:6379> SREM KEY MEMBER1..MEMBERN

返回值: 被成功移除的元素的数量,不包括被忽略的元素。

可用版本:>= 1.0.0

时间复杂度:O(N),N为给定member元素的数量。

具体实例:

  1. <?php
  2. $redis = new redis();
  3. $redis -> connect('127.0.0.1',6379);
  4. $redis -> flushAll();
  5.  
  6. $redis -> sAdd('myset','hello');
  7. $redis -> sAdd('myset','foo');
  8. $redis -> sAdd('myset','world');
  9. $redis -> sAdd('myset','hi');
  10. $redis -> sAdd('myset','welcome');
  11.  
  12. var_dump($redis -> sRem('myset','hello','foo')); // int 2
  13. var_dump($redis -> sMembers('myset'));
  14. //array (size=3)
  15. // 0 => string 'world' (length=5)
  16. // 1 => string 'welcome' (length=7)
  17. // 2 => string 'hi' (length=2)

3、SMEMBERS

Redis Smembers 命令返回集合中的所有的成员。 不存在的集合 key 被视为空集合。

语法:

redis 127.0.0.1:6379> SMEMBERS KEY VALUE

返回值: 集合中的所有成员。

可用版本:>= 1.0.0

时间复杂度:O(N),N为集合的基数。

具体实例:

  1. <?php
  2. $redis = new redis();
  3. $redis -> connect('127.0.0.1',6379);
  4. $redis -> flushAll();
  5.  
  6. $redis -> sAdd('myset','hello');
  7. $redis -> sAdd('myset','foo');
  8. $redis -> sAdd('myset','world');
  9. $redis -> sAdd('myset','hi');
  10. $redis -> sAdd('myset','welcome');
  11.  
  12. var_dump($redis -> sMembers('myset'));
  13. //array (size=5)
  14. // 0 => string 'world' (length=5)
  15. // 1 => string 'hello' (length=5)
  16. // 2 => string 'hi' (length=2)
  17. // 3 => string 'foo' (length=3)
  18. // 4 => string 'welcome' (length=7)

4、SCARD

Redis Scard 命令返回集合中元素的数量

语法:

redis 127.0.0.1:6379> SCARD KEY_NAME

返回值:集合的数量。 当集合 key 不存在时,返回 0 。

可用版本:>= 1.0.0

时间复杂度:O(1)

具体实例:

  1. <?php
  2. $redis = new redis();
  3. $redis -> connect('127.0.0.1',6379);
  4. $redis -> flushAll();
  5.  
  6. $redis -> sAdd('myset','hello');
  7. $redis -> sAdd('myset','foo');
  8. $redis -> sAdd('myset','world');
  9. $redis -> sAdd('myset','hi');
  10. $redis -> sAdd('myset','welcome');
  11.  
  12. var_dump($redis -> sCard('myset')); // int 5

5、SMOVE

Redis Smove 命令将指定成员 member 元素从 source 集合移动到 destination 集合

(1)SMOVE 是原子性操作。

(2)如果 source 集合不存在或不包含指定的 member 元素,则 SMOVE 命令不执行任何操作,仅返回 0 。否则, member 元素从 source 集合中被移除,并添加到 destination 集合中去。

(3)当 destination 集合已经包含 member 元素时, SMOVE 命令只是简单地将 source 集合中的 member 元素删除。

(4)当 source 或 destination 不是集合类型时,返回一个错误。

语法:

redis 127.0.0.1:6379> SMOVE SOURCE DESTINATION MEMBER

返回值:如果成员元素被成功移除,返回 1 。 如果成员元素不是 source 集合的成员,并且没有任何操作对 destination 集合执行,那么返回 0 。

可用版本:>= 1.0.0

时间复杂度:O(1)

具体实例:

  1. <?php
  2. $redis = new redis();
  3. $redis -> connect('127.0.0.1',6379);
  4. $redis -> flushAll();
  5.  
  6. $redis -> sAdd('myset','hello');
  7. $redis -> sAdd('myset','foo');
  8. $redis -> sAdd('myset','world');
  9. $redis -> sAdd('myset','hi');
  10. $redis -> sAdd('myset','welcome');
  11. $redis -> sAdd('destinationSet','welcome');
  12.  
  13. // The first case : member 包含在 source 中
    var_dump($redis -> sMove('myset','destinationSet','foo')); // boolean true
  14. var_dump($redis -> sMembers('myset'));
  15. //array (size=4)
  16. // 0 => string 'hello' (length=5)
  17. // 1 => string 'hi' (length=2)
  18. // 2 => string 'world' (length=5)
  19. // 3 => string 'welcome' (length=7)
  20.  
  21. // The second case : member 不在 source 中
  22. var_dump($redis -> sMove('myset','destinationSet','not_exists')); // boolean false
  23. var_dump($redis -> sMembers('myset'));
  24. //array (size=4)
  25. // 0 => string 'hi' (length=2)
  26. // 1 => string 'world' (length=5)
  27. // 2 => string 'hello' (length=5)
  28. // 3 => string 'welcome' (length=7)
  29.  
  30. // The third case : destination 中已经包含 member 元素
  31. var_dump($redis -> sMove('myset','destinationSet','welcome')); // boolean true
  32. var_dump($redis -> sMembers('myset')); // 只是将 welcome 从 myset 中移除
  33. //array (size=3)
  34. // 0 => string 'world' (length=5)
  35. // 1 => string 'hello' (length=5)
  36. // 2 => string 'hi' (length=2)

6、SPOP

Redis Spop 命令用于移除并返回集合中的一个随机元素。

语法:

redis 127.0.0.1:6379> SPOP KEY

返回值:被移除的随机元素。 当集合不存在或是空集时,返回 nil 。

可用版本:>= 1.0.0

时间复杂度:O(1)

具体实例:

  1. <?php
  2. $redis = new redis();
  3. $redis -> connect('127.0.0.1',6379);
  4. $redis -> flushAll();
  5.  
  6. $redis -> sAdd('myset','hello');
  7. $redis -> sAdd('myset','foo');
  8. $redis -> sAdd('myset','world');
  9. $redis -> sAdd('myset','hi');
  10. $redis -> sAdd('myset','welcome');
  11.  
  12. // 其值会从原集合中移除
  13. var_dump($redis -> sPop('myset')); // string world
  14. var_dump($redis -> sMembers('myset'));
  15. //array (size=4)
  16. // 0 => string 'hi' (length=2)
  17. // 1 => string 'foo' (length=3)
  18. // 2 => string 'hello' (length=5)
  19. // 3 => string 'welcome' (length=7)

7、SRANDMEMBER

Redis Srandmember 命令用于返回集合中的一个随机元素

从 Redis 2.6 版本开始, Srandmember 命令接受可选的 count 参数:

  • 如果 count 为正数,且小于集合基数,那么命令返回一个包含 count 个元素的数组,数组中的元素各不相同。如果 count 大于等于集合基数,那么返回整个集合。
  • 如果 count 为负数,那么命令返回一个数组,数组中的元素可能会重复出现多次,而数组的长度为 count 的绝对值。

该操作和 SPOP 相似,但 SPOP 将随机元素从集合中移除并返回,而 Srandmember 则仅仅返回随机元素,而不对集合进行任何改动

语法:

redis 127.0.0.1:6379> SRANDMEMBER KEY [count]

返回值:(1)只提供集合 key 参数时,返回一个元素;

    (2) 如果提供了 count 参数, 若 0<count<集合基数,那么返回一个包含count个元素的数组, 若 count>集合基数,那么返回整个集合

    (3)如果提供了 count 参数, 若 count<0,且 count的绝对值<集合基数,那么返回一个包含count个元素的数组,若 count的绝对值>集合基数,那么返回包含count个元素的数组,元素可能重复出现多次

可用版本:>= 1.0.0

时间复杂度:O(1)

具体实例:

  1. <?php
  2. $redis = new redis();
  3. $redis -> connect('127.0.0.1',6379);
  4. $redis -> flushAll();
  5.  
  6. $redis -> sAdd('myset','hello');
  7. $redis -> sAdd('myset','foo');
  8. $redis -> sAdd('myset','world');
  9. $redis -> sAdd('myset','hi');
  10. $redis -> sAdd('myset','welcome');
  11.  
  12. // The first case : 当没有 count 参数时,返回一个随机值,其值不会从原集合中移除
  13. var_dump($redis -> sRandMember('myset')); // string foo
  14. var_dump($redis -> sMembers('myset'));
  15. //array (size=5)
  16. // 0 => string 'hello' (length=5)
  17. // 1 => string 'hi' (length=2)
  18. // 2 => string 'foo' (length=3)
  19. // 3 => string 'world' (length=5)
  20. // 4 => string 'welcome' (length=7)
  21.  
  22. // The second case : 当 0 < count < 集合基数
  23. var_dump($redis -> sRandMember('myset',3)); // 返回包含 count 个元素的集合
  24. //array (size=3)
  25. // 0 => string 'world' (length=5)
  26. // 1 => string 'hello' (length=5)
  27. // 2 => string 'foo' (length=3)
  28.  
  29. // The third case : 当 0 < count 且 集合基数 < count
  30. var_dump($redis -> sRandMember('myset',10)); // 返回整个集合
  31. //array (size=5)
  32. // 0 => string 'world' (length=5)
  33. // 1 => string 'hello' (length=5)
  34. // 2 => string 'foo' (length=3)
  35. // 3 => string 'hi' (length=2)
  36. // 4 => string 'welcome' (length=7)
  37.  
  38. // The fourth case : 当 count<0 且 |count| < 集合基数
  39. var_dump($redis -> sRandMember('myset',-3)); // 返回包含 count 个元素的集合
  40. //array (size=3)
  41. // 0 => string 'hello' (length=5)
  42. // 1 => string 'welcome' (length=7)
  43. // 2 => string 'world' (length=5)
  44.  
  45. // The fifth case : 当 count<0 且 |count| > 集合基数
  46. var_dump($redis -> sRandMember('myset',-8)); // 返回包含 count 个元素的集合,有重复
  47. //array (size=8)
  48. // 0 => string 'world' (length=5)
  49. // 1 => string 'welcome' (length=7)
  50. // 2 => string 'world' (length=5)
  51. // 3 => string 'welcome' (length=7)
  52. // 4 => string 'hello' (length=5)
  53. // 5 => string 'hello' (length=5)
  54. // 6 => string 'world' (length=5)
  55. // 7 => string 'welcome' (length=7)

8、SINTER

Redis Sinter 命令返回给定所有给定集合的交集。 不存在的集合 key 被视为空集。 当给定集合当中有一个空集时,结果也为空集(根据集合运算定律)。

语法:

redis 127.0.0.1:6379> SINTER KEY KEY1..KEYN

返回值:交集成员的列表。

可用版本:>= 1.0.0

时间复杂度:O(1)

具体实例:

  1. <?php
  2. $redis = new redis();
  3. $redis -> connect('127.0.0.1',6379);
  4. $redis -> flushAll();
  5.  
  6. $redis -> sAdd('myset','hello');
  7. $redis -> sAdd('myset','foo');
  8. $redis -> sAdd('myset','world');
  9. $redis -> sAdd('myset','hi');
  10. $redis -> sAdd('myset','welcome');
  11.  
  12. $redis -> sAdd('otherset','hello');
  13. $redis -> sAdd('otherset','world');
  14. $redis -> sAdd('otherset','welcome');
  15.  
  16. // The first case : 集合都不为空 , 原集合不变
  17. var_dump($redis -> sInter('myset','otherset'));
  18. //array (size=3)
  19. // 0 => string 'welcome' (length=7)
  20. // 1 => string 'world' (length=5)
  21. // 2 => string 'hello' (length=5)
  22.  
  23. // The second case : 有空集合
  24. var_dump($redis -> sInter('myset','emptyset')); // array (size=0) empty

9、SINTERSTORE

Redis Sinterstore 命令将给定集合之间的交集存储在指定的集合中。如果指定的集合已经存在,则将其覆盖。

语法:

redis 127.0.0.1:6379> SINTERSTORE DESTINATION_KEY KEY KEY1..KEYN

返回值:交集成员的列表。

可用版本:>= 1.0.0

时间复杂度:O(N * M),N为给定集合当中基数最小的集合,M为给定集合的个数。

具体实例:

  1. <?php
  2. $redis = new redis();
  3. $redis -> connect('127.0.0.1',6379);
  4. $redis -> flushAll();
  5.  
  6. $redis -> sAdd('myset','hello');
  7. $redis -> sAdd('myset','foo');
  8. $redis -> sAdd('myset','world');
  9. $redis -> sAdd('myset','hi');
  10. $redis -> sAdd('myset','welcome');
  11.  
  12. $redis -> sAdd('otherset','hello');
  13. $redis -> sAdd('otherset','world');
  14. $redis -> sAdd('otherset','welcome');
  15.  
  16. $redis -> sAdd('other_destinationset','hello');
  17.  
  18. // The first case : 目标集合不存在
  19. var_dump($redis -> sInterStore('destinationset','myset','otherset')); // int 3
  20. var_dump($redis -> sMembers('destinationset'));
  21. //array (size=3)
  22. // 0 => string 'welcome' (length=7)
  23. // 1 => string 'world' (length=5)
  24. // 2 => string 'hello' (length=5)
  25.  
  26. // The second case : 目标集合已存在
  27. var_dump($redis -> sInterStore('other_destinationset','myset','otherset'));
  28. var_dump($redis -> sMembers('other_destinationset')); // 覆盖
  29. //array (size=3)
  30. // 0 => string 'welcome' (length=7)
  31. // 1 => string 'world' (length=5)
  32. // 2 => string 'hello' (length=5)

10、SUNION

Redis Sunion 命令返回给定集合的并集。不存在的集合 key 被视为空集。

语法:

redis 127.0.0.1:6379> SUNION KEY KEY1..KEYN

返回值:并集成员的列表。

可用版本:>= 1.0.0

时间复杂度:O(N),N是所有给定集合的成员数量之和

具体实例:

  1. <?php
  2. $redis = new redis();
  3. $redis -> connect('127.0.0.1',6379);
  4. $redis -> flushAll();
  5.  
  6. $redis -> sAdd('myset','hello');
  7. $redis -> sAdd('myset','foo');
  8. $redis -> sAdd('myset','world');
  9. $redis -> sAdd('myset','hi');
  10. $redis -> sAdd('myset','welcome');
  11.  
  12. $redis -> sAdd('otherset','hello');
  13. $redis -> sAdd('otherset','world');
  14. $redis -> sAdd('otherset','good');
  15.  
  16. // The first case : 集合都不为空 , 原集合不变
  17. var_dump($redis -> sUnion('myset','otherset'));
  18. //array (size=6)
  19. // 0 => string 'world' (length=5)
  20. // 1 => string 'hello' (length=5)
  21. // 2 => string 'welcome' (length=7)
  22. // 3 => string 'good' (length=4)
  23. // 4 => string 'hi' (length=2)
  24. // 5 => string 'foo' (length=3)
  25.  
  26. // The second case : 有空集合
  27. var_dump($redis -> sUnion('myset','emptyset'));
  28. //array (size=5)
  29. // 0 => string 'world' (length=5)
  30. // 1 => string 'hello' (length=5)
  31. // 2 => string 'foo' (length=3)
  32. // 3 => string 'hi' (length=2)
  33. // 4 => string 'welcome' (length=7)

11、SUNIONSTORE

Redis Sunionstore 命令将给定集合的并集存储在指定的集合 destination 中。如果 destination 已经存在,则将其覆盖。

语法:

redis 127.0.0.1:6379> SUNIONSTORE DESTINATION KEY KEY1..KEYN

返回值:结果集中的元素数量。

可用版本:>= 1.0.0

时间复杂度:O(N),N是所有给定集合的成员数量之和。

具体实例:

  1. <?php
  2. $redis = new redis();
  3. $redis -> connect('127.0.0.1',6379);
  4. $redis -> flushAll();
  5.  
  6. $redis -> sAdd('myset','hello');
  7. $redis -> sAdd('myset','foo');
  8. $redis -> sAdd('myset','world');
  9. $redis -> sAdd('myset','hi');
  10. $redis -> sAdd('myset','welcome');
  11.  
  12. $redis -> sAdd('otherset','hello');
  13. $redis -> sAdd('otherset','world');
  14. $redis -> sAdd('otherset','good');
  15.  
  16. $redis -> sAdd('other_destinationset','hello');
  17.  
  18. // The first case : 目标集合不存在
  19. var_dump($redis -> sUnionStore('destinationset','myset','otherset')); // int 6
  20. var_dump($redis -> sMembers('destinationset'));
  21. //array (size=6)
  22. // 0 => string 'world' (length=5)
  23. // 1 => string 'hello' (length=5)
  24. // 2 => string 'welcome' (length=7)
  25. // 3 => string 'good' (length=4)
  26. // 4 => string 'hi' (length=2)
  27. // 5 => string 'foo' (length=3)
  28.  
  29. // The second case : 目标集合已存在
  30. var_dump($redis -> sUnionStore('other_destinationset','myset','otherset')); // int 6
  31. var_dump($redis -> sMembers('other_destinationset')); // 覆盖
  32. //array (size=6)
  33. // 0 => string 'world' (length=5)
  34. // 1 => string 'hello' (length=5)
  35. // 2 => string 'welcome' (length=7)
  36. // 3 => string 'good' (length=4)
  37. // 4 => string 'hi' (length=2)
  38. // 5 => string 'foo' (length=3)

12、SDIFF

Redis Sdiff 命令返回给定集合之间的差集。不存在的集合 key 将视为空集。

语法:

redis 127.0.0.1:6379> SDIFF FIRST_KEY OTHER_KEY1..OTHER_KEYN

返回值:包含差集成员的列表。

可用版本:>= 1.0.0

时间复杂度:O(N),N是所有给定集合的成员数量之和。

具体实例:

  1. <?php
  2. $redis = new redis();
  3. $redis -> connect('127.0.0.1',6379);
  4. $redis -> flushAll();
  5.  
  6. $redis -> sAdd('myset','hello');
  7. $redis -> sAdd('myset','foo');
  8. $redis -> sAdd('myset','world');
  9. $redis -> sAdd('myset','hi');
  10. $redis -> sAdd('myset','welcome');
  11.  
  12. $redis -> sAdd('otherset','hello');
  13. $redis -> sAdd('otherset','world');
  14. $redis -> sAdd('otherset','good');
  15.  
  16. var_dump($redis -> sDiff('myset','otherset')); // 此处的差集指的是第一个集合的元素,不包含后面集合的元素
  17. //array (size=3)
  18. // 0 => string 'welcome' (length=7)
  19. // 1 => string 'foo' (length=3)
  20. // 2 => string 'hi' (length=2)

13、SDIFFSTORE

Redis Sdiffstore 命令将给定集合之间的差集存储在指定的集合中。如果指定的集合 key 已存在,则会被覆盖。

语法:

redis 127.0.0.1:6379> SDIFFSTORE DESTINATION_KEY KEY1..KEYN

返回值:结果集中的元素数量。

可用版本:>= 1.0.0

时间复杂度:O(N),N是所有给定集合的成员数量之和。

具体实例:

  1. <?php
  2. $redis = new redis();
  3. $redis -> connect('127.0.0.1',6379);
  4. $redis -> flushAll();
  5.  
  6. $redis -> sAdd('myset','hello');
  7. $redis -> sAdd('myset','foo');
  8. $redis -> sAdd('myset','world');
  9. $redis -> sAdd('myset','hi');
  10. $redis -> sAdd('myset','welcome');
  11.  
  12. $redis -> sAdd('otherset','hello');
  13. $redis -> sAdd('otherset','world');
  14. $redis -> sAdd('otherset','good');
  15.  
  16. $redis -> sAdd('other_destinationset','hello');
  17.  
  18. // The first case : 目标集合不存在
  19. var_dump($redis -> sDiffStore('destinationset','myset','otherset')); // int 3, 此处指的是第一个集合中的元素
  20. var_dump($redis -> sMembers('destinationset'));
  21. //array (size=3)
  22. // 0 => string 'welcome' (length=7)
  23. // 1 => string 'foo' (length=3)
  24. // 2 => string 'hi' (length=2)
  25.  
  26. // The second case : 目标集合已存在
  27. var_dump($redis -> sDiffStore('other_destinationset','myset','otherset')); // int 3
  28. var_dump($redis -> sMembers('other_destinationset')); // 覆盖
  29. //array (size=3)
  30. // 0 => string 'welcome' (length=7)
  31. // 1 => string 'foo' (length=3)
  32. // 2 => string 'hi' (length=2)

14、SISMEMBER

Redis Sismember 命令判断成员元素是否是集合的成员。

语法:

redis 127.0.0.1:6379> SISMEMBER KEY VALUE

返回值:如果成员元素是集合的成员,返回 1 。 如果成员元素不是集合的成员,或 key 不存在,返回 0 。

可用版本:>= 1.0.0

时间复杂度:O(1)

具体实例:

  1. <?php
  2. $redis = new redis();
  3. $redis -> connect('127.0.0.1',6379);
  4. $redis -> flushAll();
  5.  
  6. $redis -> sAdd('myset','hello');
  7. $redis -> sAdd('myset','foo');
  8. $redis -> sAdd('myset','world');
  9. $redis -> sAdd('myset','hi');
  10. $redis -> sAdd('myset','welcome');
  11.  
  12. var_dump($redis -> sIsMember('myset','hello')); // true
  13. var_dump($redis -> sIsMember('myset','good')); // false

下一篇:redis 在php中的应用(Sorted-set篇)

如有转载,请注明出处:http://www.cnblogs.com/chrdai/p/6846352.html

redis 在 php 中的应用(Set篇)的更多相关文章

  1. redis 在 php 中的应用(List篇)

    本文为我阅读了 redis参考手册 之后编写,注意 php_redis 和 redis-cli 的区别(主要是返回值类型和参数用法) 目录: List(列表) LPUSH LPUSHX RPUSH R ...

  2. .NET 环境中使用RabbitMQ RabbitMQ与Redis队列对比 RabbitMQ入门与使用篇

    .NET 环境中使用RabbitMQ   在企业应用系统领域,会面对不同系统之间的通信.集成与整合,尤其当面临异构系统时,这种分布式的调用与通信变得越发重要.其次,系统中一般会有很多对实时性要求不高的 ...

  3. redis 在 php 中的应用(Sorted-set篇)

    本文为我阅读了 redis参考手册 之后编写,注意 php_redis 和 redis-cli 的区别(主要是返回值类型和参数用法) Redis 有序集合和集合一样也是string类型元素的集合,且不 ...

  4. redis 在 php 中的应用(Connection [ 连接] 篇)

    本文为我阅读了 redis参考手册 之后编写,注意 php_redis 和 redis-cli 的区别(主要是返回值类型和参数用法) 目录: Connection(连接) AUTH ECHO PING ...

  5. Redis从入门到精通:初级篇

    原文链接:http://www.cnblogs.com/xrq730/p/8890896.html,转载请注明出处,谢谢 Redis从入门到精通:初级篇 平时陆陆续续看了不少Redis的文章了,工作中 ...

  6. Redis从入门到精通:中级篇

    原文链接:http://www.cnblogs.com/xrq730/p/8944539.html,转载请注明出处,谢谢 本文目录 上一篇文章以认识Redis为主,写了Redis系列的第一篇,现在开启 ...

  7. redis 在 php 中的应用

    一.redis 在 php 中的应用(Key篇) 二.redis 在 php 中的应用(String篇) 三.redis 在 php 中的应用(Hash篇) 四.redis 在 php 中的应用(Li ...

  8. 【*】Redis实战场景中相关问题

    一.Redis简介 redis主要解决的问题 分布式缓存是分布式系统中的重要组件,主要解决高并发.大数据场景下,热点数据访问的性能问题,提供高性能的数据快速访问. 使用缓存常见场景 项目中部分数据访问 ...

  9. Redis从入门到精通:中级篇(转)

    原文链接:http://www.cnblogs.com/xrq730/p/8944539.html,转载请注明出处,谢谢 本文目录 上一篇文章以认识Redis为主,写了Redis系列的第一篇,现在开启 ...

随机推荐

  1. day29 二十九、元类、单例

    一.eval.exec内置函数 1.eval函数 eval内置函数的使用场景: ①执行字符串会得到相应的执行结果 ②一般用于类型转换得到dict.list.tuple等 2.exec函数 exec应用 ...

  2. 弄懂JDK、JRE和JVM到底是什么

    首先是JDK JDK(Java Development Kit) 是 Java 语言的软件开发工具包(SDK).在JDK的安装目录下有一个jre目录,里面有两个文件夹bin和lib,在这里可以认为bi ...

  3. 两个左连接SQL执行计划解析(Oracle和PGSQL对比):

    上一篇解析链接如下: https://www.cnblogs.com/wcwen1990/p/9325968.html 1.SQL示例1: SQL> select * from ( select ...

  4. css table之合并单元格

    colspan 是合并列,rowspan是合并行,合并行的时候,比如rowspan="2",它的下一行tr会少一列:合并列的时候 colspan="2",此行的 ...

  5. MongoDB - Indexes

    #explain command pp db[:zips].find(:state => 'MD').explain #List all indexes: db[:zips].indexes.e ...

  6. Spring Boot(三):AOP&日志操作&异常处理

    一.AOP:HttpAspect.java 二.操作日志 在HttpAspect.java中调用org.slf4j.Logger.org.slf4j.LoggerFactory 三.异常处理 1.定义 ...

  7. OFFICE 您正试图运行的函数包含有宏或需要宏语言支持的内容。

    故障现象:打开WORD的时候,提示“您正试图运行的函数包含有宏或需要宏语言支持的内容.而在安装此软件时,您(或您的管理员)选择了不安装宏或控件的支持功能”. 提示现象: 解决办法 : 1.进入“控制面 ...

  8. 【VIM】-NO.140.VIM.1 -【VIM】

    Style:Mac Series:Java Since:2018-09-10 End:2018-09-10 Total Hours:1 Degree Of Diffculty:5 Degree Of ...

  9. UML第三次作业

    一.PlantUML类图 语法学习小结 关系上的标识:在关系之间使用标签来说明时, 使用 :后接 标签文字.对元素的说明,可以在每一边使用 "" 来说明. 1 @startuml ...

  10. Cocos Creator 生命周期回调(官方文档摘录)

    Cocos Creator 为组件脚本提供了生命周期的回调函数.用户通过定义特定的函数回调在特定的时期编写相关 脚本.目前提供给用户的声明周期回调函数有: onLoad start update la ...