{"id":201563,"date":"2025-05-10T12:00:10","date_gmt":"2025-05-10T04:00:10","guid":{"rendered":"https:\/\/server.hk\/cnblog\/201563\/"},"modified":"2025-05-10T12:00:10","modified_gmt":"2025-05-10T04:00:10","slug":"%e4%b8%ba%e5%95%a5redis10%e4%ba%bf%e6%95%b0%e6%8d%ae%e9%87%8f%e5%8f%aa%e8%a6%81100mb%e5%86%85%e5%ad%98%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/201563\/","title":{"rendered":"\u4e3a\u5565Redis10\u4ebf\u6570\u636e\u91cf\u53ea\u8981100MB\u5185\u5b58\uff1f"},"content":{"rendered":"<p><b><\/b> <\/p>\n<h1>\u4e3a\u5565Redis10\u4ebf\u6570\u636e\u91cf\u53ea\u8981100MB\u5185\u5b58\uff1f<\/h1>\n<p><span style=\"cursor: pointer\"><i><\/i>\u6536\u85cf<\/span> <\/p>\n<p>\u5927\u5bb6\u597d\uff0c\u4eca\u5929\u672c\u4eba\u7ed9\u5927\u5bb6\u5e26\u6765\u6587\u7ae0<span style=\"color: #FF6600;font-family:\">\u300a\u4e3a\u5565Redis10\u4ebf\u6570\u636e\u91cf\u53ea\u8981100MB\u5185\u5b58\uff1f\u300b<\/span>\uff0c\u6587\u4e2d\u5185\u5bb9\u4e3b\u8981\u6d89\u53ca\u5230<span style=\"color: #FF6600;font-family:\"><span style=\"color: #FF6600;font-family:\">\u5185\u5b58\u3001Redis\u3001\u6570\u636e\u5e93<\/span><\/span>\uff0c\u5982\u679c\u4f60\u5bf9<span style=\"color: #FF6600;font-family:\">\u6570\u636e\u5e93<\/span>\u65b9\u9762\u7684\u77e5\u8bc6\u70b9\u611f\u5174\u8da3\uff0c\u90a3\u5c31\u8bf7\u5404\u4f4d\u670b\u53cb\u7ee7\u7eed\u770b\u4e0b\u53bb\u5427~\u5e0c\u671b\u80fd\u771f\u6b63\u5e2e\u5230\u4f60\u4eec\uff0c\u8c22\u8c22\uff01<\/p>\n<p>\u672c\u6587\u4e3b\u8981\u548c\u5927\u5bb6\u5206\u4eab\u4e00\u4e0bredis\u7684\u9ad8\u7ea7\u7279\u6027\uff1abit\u4f4d\u64cd\u4f5c\u3002<\/p>\n<p>\u529b\u6c42\u8ba9\u5927\u5bb6\u5f7b\u5e95\u5b66\u4f1a\u4f7f\u7528redis\u7684bit\u4f4d\u64cd\u4f5c\u5e76\u638c\u63e1\u5176\u5e95\u5c42\u5b9e\u73b0\u539f\u7406\uff01\u4e3b\u8981\u5305\u542b\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<ol>\n<li>\n<p>&nbsp;redis\u4f4d\u64cd\u4f5c\u547d\u4ee4\u793a\u4f8b<\/p>\n<\/li>\n<li>\n<p>&nbsp;\u5e95\u5c42\u6570\u636e\u7ed3\u6784\u5206\u6790<\/p>\n<\/li>\n<li>\n<p>&nbsp;\u4e3a\u4ec0\u4e48\u4ed6\u7684\u7b97\u6cd5\u65f6\u95f4\u590d\u6742\u5ea6\u662fO(1)?<\/p>\n<\/li>\n<li>\n<p>&nbsp;10\u4ebf\u6570\u636e\u91cf\u9700\u8981\u591a\u5927\u7684\u5b58\u50a8\u7a7a\u95f4\uff1f<\/p>\n<\/li>\n<li>\n<p>&nbsp;redis\u4f4d\u64cd\u4f5c\u9002\u5408\u54ea\u4e9b\u5e94\u7528\u573a\u666f\uff1f<\/p>\n<\/li>\n<\/ol>\n<p>\u672c\u6587redis\u8bd5\u9a8c\u4ee3\u7801\u57fa\u4e8e\u5982\u4e0b\u73af\u5883\uff1a<\/p>\n<p>\u64cd\u4f5c\u7cfb\u7edf\uff1aMac OS 64\u4f4d<\/p>\n<p>\u7248\u672c\uff1aRedis 5.0.7 64 bit<\/p>\n<p>\u8fd0\u884c\u6a21\u5f0f\uff1astandalone mode<\/p>\n<p>redis\u4f4d\u64cd\u4f5c<\/p>\n<p>reids\u4f4d\u64cd\u4f5c\u4e5f\u53eb\u4f4d\u6570\u7ec4\u64cd\u4f5c\u3001bitmap\uff0c\u5b83\u63d0\u4f9b\u4e86SETBIT\u3001GETBIT\u3001BITCOUNT\u3001BITTOP\u56db\u4e2a\u547d\u4ee4\u7528\u4e8e\u64cd\u4f5c\u4e8c\u8fdb\u5236\u4f4d\u6570\u7ec4\u3002<\/p>\n<p>\u5148\u6765\u770b\u4e00\u6ce2\u57fa\u672c\u64cd\u4f5c\u793a\u4f8b<\/p>\n<\/p>\n<p><strong>SETBIT<\/strong><\/p>\n<p>\u8bed\u6cd5\uff1a<strong>SETBIT key offset value<\/strong><\/p>\n<p>\u5373\uff1a<strong>\u547d\u4ee4 key \u504f\u79fb\u91cf 0\/1<\/strong><\/p>\n<p>setbit\u547d\u4ee4\u7528\u4e8e\u5199\u5165\u4f4d\u6570\u7ec4\u6307\u5b9a\u504f\u79fb\u91cf\u7684\u4e8c\u8fdb\u5236\u4f4d\u8bbe\u7f6e\u503c\uff0c\u504f\u79fb\u91cf\u4ece0\u5f00\u59cb\u8ba1\u6570\uff0c\u4e14\u53ea\u5141\u8bb8\u5199\u51651\u6216\u80050\uff0c\u5982\u679c\u5199\u5165\u975e0\u548c1\u7684\u503c\u5219\u5199\u5165\u5931\u8d25\uff1a<\/p>\n<\/p>\n<p><strong>GETBIT<\/strong><\/p>\n<p>\u8bed\u6cd5\uff1a<strong>GETBIT key offset<\/strong><\/p>\n<p>\u5373\uff1a<strong>\u547d\u4ee4 key \u504f\u79fb\u91cf<\/strong><\/p>\n<p>gitbit\u547d\u4ee4\u7528\u4e8e\u83b7\u53d6\u4f4d\u6570\u7ec4\u6307\u5b9a\u504f\u79fb\u91cf\u4e0a\u7684\u4e8c\u8fdb\u5236\u503c\uff1a<\/p>\n<\/p>\n<p><strong>BITCOUNT<\/strong><\/p>\n<p>\u8bed\u6cd5\uff1a<strong>BITCOUNT key<\/strong><\/p>\n<p>\u5373\uff1a<strong>\u547d\u4ee4 key<\/strong><\/p>\n<p>bitcount\u547d\u4ee4\u7528\u4e8e\u83b7\u53d6\u6307\u5b9akey\u7684\u4f4d\u6570\u7ec4\u4e2d\u503c\u4e3a1\u7684\u4e8c\u8fdb\u5236\u4f4d\u7684\u6570\u91cf\uff0c\u4e4b\u524d\u6211\u4eec\u5199\u5165\u4e86\u504f\u79fb\u91cf0\u7684\u503c\u4e3a1\uff0c\u504f\u79fb\u91cf10 \u7684\u503c\u4e3a1\uff0c\u504f\u79fb\u91cf8\u7684\u503c\u4e3a0\uff1a<\/p>\n<\/p>\n<p><strong>BITOP<\/strong><\/p>\n<p>\u8bed\u6cd5\uff1a<strong>BITOP operation destkey key [key&#8230;]<\/strong><\/p>\n<p>\u5373\uff1a<strong>\u547d\u4ee4 \u64cd\u4f5c \u7ed3\u679c\u76ee\u6807key key1 key2 &#8230;<\/strong><\/p>\n<p>bitop\u547d\u4ee4\u53ef\u4ee5\u5bf9\u591a\u4e2a\u4f4d\u6570\u7ec4\u7684key\u8fdb\u884cand\uff08\u6309\u4f4d\u4e0e\uff09\u3001or\uff08\u6309\u4f4d\u6216\uff09\u3001xor\uff08\u6309\u4f4d\u5f02\u6216\uff09\u8fd0\u7b97\uff0c\u5e76\u5c06\u8fd0\u7b97\u7ed3\u679c\u8bbe\u7f6e\u5230destkey\u4e2d\uff1a<\/p>\n<\/p>\n<p><strong>\u5e95\u5c42\u6570\u636e\u7ed3\u6784\u5206\u6790<\/strong><\/p>\n<p>SDS\u662fredis\u4e2d\u7684\u4e00\u79cd\u6570\u636e\u7ed3\u6784\uff0c\u53eb\u505a\u7b80\u5355\u52a8\u6001\u5b57\u7b26\u4e32\uff08Simple Dynamic String\uff09\uff0c\u5e76\u4e14\u5b83\u662f\u4e00\u79cd\u4e8c\u8fdb\u5236\u5b89\u5168\u7684\uff0c\u5728\u5927\u591a\u6570\u7684\u60c5\u51b5\u4e0bredis\u4e2d\u7684\u5b57\u7b26\u4e32\u90fd\u7528SDS\u6765\u5b58\u50a8\u3002<\/p>\n<p>SDS\u7684\u6570\u636e\u7ed3\u6784\uff1a&nbsp;<\/p>\n<\/p>\n<ol>\n<li>\n<p>struct&nbsp;sdshdr&nbsp;{&nbsp;&nbsp;<\/p>\n<\/li>\n<li>\n<p>&nbsp;#\u8bb0\u5f55buff\u6570\u7ec4\u4e2d\u5df2\u4f7f\u7528\u5b57\u8282\u7684\u6570\u91cf&nbsp;&nbsp;<\/p>\n<\/li>\n<li>\n<p>&nbsp;#\u4e5f\u662fSDS\u6240\u4fdd\u5b58\u5b57\u7b26\u4e32\u7684\u957f\u5ea6&nbsp;&nbsp;<\/p>\n<\/li>\n<li>\n<p>&nbsp;int&nbsp;len;&nbsp;&nbsp;<\/p>\n<\/li>\n<li>\n<p>&nbsp;#\u8bb0\u5f55buff\u6570\u7ec4\u4e2d\u672a\u4f7f\u7528\u5b57\u8282\u7684\u6570\u91cf&nbsp;&nbsp;<\/p>\n<\/li>\n<li>\n<p>&nbsp;int&nbsp;free;&nbsp;&nbsp;<\/p>\n<\/li>\n<li>\n<p>&nbsp;#\u5b57\u8282\u6570\u7ec4\uff0c\u5b57\u7b26\u4e32\u5c31\u5b58\u50a8\u5728\u8fd9\u4e2a\u6570\u7ec4\u91cc&nbsp;&nbsp;<\/p>\n<\/li>\n<li>\n<p>&nbsp;char&nbsp;buff[];&nbsp;&nbsp;<\/p>\n<\/li>\n<li>\n<p>}&nbsp;<\/p>\n<\/li>\n<\/ol>\n<p>\u6570\u636e\u5b58\u50a8\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p>\u56fe\u7247\u6765\u6e90\u300aredis\u8bbe\u8ba1\u4e0e\u5b9e\u73b0\u300b<\/p>\n<p>SDS\u7684\u4f18\u70b9\uff1a<\/p>\n<ol>\n<li>\n<p>&nbsp;\u65f6\u95f4\u590d\u6742\u5ea6\u4e3aO(1)<\/p>\n<\/li>\n<li>\n<p>&nbsp;\u675c\u7edd\u7f13\u51b2\u533a\u6ea2\u51fa<\/p>\n<\/li>\n<li>\n<p>&nbsp;\u51cf\u5c11\u4fee\u6539\u5b57\u7b26\u4e32\u957f\u5ea6\u65f6\u5019\u6240\u9700\u7684\u5185\u5b58\u91cd\u5206\u914d\u6b21\u6570<\/p>\n<\/li>\n<li>\n<p>&nbsp;\u4e8c\u8fdb\u5236\u5b89\u5168\u7684API\u64cd\u4f5c<\/p>\n<\/li>\n<li>\n<p>&nbsp;\u517c\u5bb9\u90e8\u5206C\u5b57\u7b26\u4e32\u51fd\u6570<\/p>\n<\/li>\n<\/ol>\n<p><strong>\u5173\u4e8eSDS\u7684\u8be6\u7ec6\u4ecb\u7ecd\u8bf7\u5927\u5bb6\u53c2\u9605\u300aredis\u8bbe\u8ba1\u4e0e\u5b9e\u73b0\u300b\u4e00\u6587\u3002<\/strong><\/p>\n<p>redis\u4e2d\u7684\u4f4d\u6570\u7ec4\u91c7\u7528\u7684\u662fString\u5b57\u7b26\u4e32\u6570\u636e\u683c\u5f0f\u6765\u5b58\u50a8\uff0c\u800c\u5b57\u7b26\u4e32\u5bf9\u8c61\u4f7f\u7528\u7684\u6b63\u662f\u4e0a\u6587\u8bf4\u7684SDS\u7b80\u5355\u52a8\u6001\u5b57\u7b26\u4e32\u6570\u636e\u7ed3\u6784\u3002<\/p>\n<\/p>\n<p>\u56fe\u7247\u6765\u6e90\u300aredis\u8bbe\u8ba1\u4e0e\u5b9e\u73b0\u300b<\/p>\n<p>\u5927\u5bb6\u90fd\u77e5\u9053\u7684\u662f\u4e00\u4e2a\u5b57\u8282\u7528\u7684\u662f8\u4e2a\u4e8c\u8fdb\u5236\u4f4d\u6765\u5b58\u50a8\u7684\uff0c\u4e5f\u5c31\u662f8\u4e2a0\u6216\u80051\uff0c\u5373\u4e00\u4e2a\u5b57\u8282\u53ef\u4ee5\u5b58\u50a8\u5341\u8fdb\u52360~127\u7684\u6570\u5b57\uff0c\u4e5f\u5373\u5305\u542b\u4e86\u6240\u6709\u7684\u6570\u5b57\u3001\u82f1\u6587\u5927\u5c0f\u5199\u5b57\u6bcd\u4ee5\u53ca\u6807\u70b9\u7b26\u53f7\u3002<\/p>\n<p><strong>1Byte=8bit<br \/><\/strong><\/p>\n<p><strong>1KB=1024Byte<br \/><\/strong><\/p>\n<p><strong>1MB=1024KB<br \/><\/strong><\/p>\n<p><strong>1GB=1024MB<\/strong><\/p>\n<p>\u4f4d\u6570\u7ec4\u5728redis\u5b58\u50a8\u4e16\u754c\u91cc\uff0c\u6bcf\u4e00\u4e2a\u5b57\u8282\u4e5f\u662f8\u4f4d\uff0c\u521d\u59cb\u90fd\u662f\uff1a&nbsp;<\/p>\n<\/p>\n<ol>\n<li>\n<p>0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;<\/p>\n<\/li>\n<\/ol>\n<p>\u800c\u4f4d\u64cd\u4f5c\u5c31\u662f\u5728\u5bf9\u5e94\u7684offset\u504f\u79fb\u91cf\u4e0a\u8bbe\u7f6e0\u6216\u80051\uff0c\u6bd4\u5982\u5c06\u7b2c3\u4f4d\u8bbe\u7f6e\u4e3a1\uff0c\u5373\uff1a&nbsp;<\/p>\n<\/p>\n<ol>\n<li>\n<p>0&nbsp;0&nbsp;0&nbsp;0&nbsp;1&nbsp;0&nbsp;0&nbsp;0&nbsp;&nbsp;<\/p>\n<\/li>\n<li>\n<p>#\u5bf9\u5e94redis\u64cd\u4f5c\u5373\uff1a&nbsp;&nbsp;<\/p>\n<\/li>\n<li>\n<p>setbit&nbsp;key&nbsp;3&nbsp;1&nbsp;<\/p>\n<\/li>\n<\/ol>\n<p>\u5728\u6b64\u57fa\u7840\u4e0a\uff0c\u5982\u679c\u8981\u5728\u504f\u79fb\u91cf\u4e3a13\u7684\u4f4d\u7f6e\u8bbe\u7f6e1\uff0c\u5373\uff1a&nbsp;<\/p>\n<\/p>\n<ol>\n<li>\n<p>setbit&nbsp;key&nbsp;13&nbsp;1&nbsp;&nbsp;<\/p>\n<\/li>\n<li>\n<p>#\u5bf9\u5e94redis\u4e2d\u7684\u5b58\u50a8\u4e3a\uff1a&nbsp;&nbsp;<\/p>\n<\/li>\n<li>\n<p>0&nbsp;0&nbsp;1&nbsp;0&nbsp;|&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;|&nbsp;0&nbsp;0&nbsp;0&nbsp;0&nbsp;|&nbsp;1&nbsp;0&nbsp;0&nbsp;0&nbsp;<\/p>\n<\/li>\n<\/ol>\n<p><strong>\u65f6\u95f4\u590d\u6742\u5ea6<br \/><\/strong><\/p>\n<p><strong>GETBIT\u547d\u4ee4\u65f6\u95f4\u590d\u6742\u5ea6O(1)<br \/><\/strong><\/p>\n<p><strong>STEBIT\u547d\u4ee4\u65f6\u95f4\u590d\u6742\u5ea6O(1)<br \/><\/strong><\/p>\n<p><strong>BITCOUNT\u547d\u4ee4\u65f6\u95f4\u590d\u6742\u5ea6O(n)<br \/><\/strong><\/p>\n<p><strong>BITOP\u547d\u4ee4\u65f6\u95f4\u590d\u6742\u5ea6O(n)\u3001O(n2)<\/strong><\/p>\n<p>\u6211\u4eec\u6765\u770bGETBIT\u4ee5\u53caSETBIT\u547d\u4ee4\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a\u4ec0\u4e48\u662fO(1)\uff0c\u5f53\u6211\u4eec\u6267\u884c\u4e00\u4e2aSETBIT key 10086 1\u7684\u503c\u7684\u65f6\u5019\uff0creids\u7684\u8ba1\u7b97\u65b9\u5f0f\u5982\u4e0b\uff1a<\/p>\n<p>\u83b7\u53d6\u5230\u8981\u5199\u5165\u4f4d\u6570\u7ec4\u4e2d\u7684\u54ea\u4e2a\u5b57\u8282\uff1a10086\u00f78=1260\uff0c\u9700\u8981\u5199\u5165\u5230\u4f4d\u6570\u7ec4\u7684\u4e0b\u68071260\u7684\u5b57\u8282<\/p>\n<p>\u83b7\u53d6\u8981\u5199\u5165\u5230\u8fd9\u4e2a\u5b57\u8282\u7684\u7b2c\u51e0\u4f4d\uff1a10086 mod 8 = 6\uff0c\u9700\u8981\u5199\u5165\u5230\u8fd9\u4e2a\u5b57\u8282\u7684\u4e0b\u6807\u4e3a6\u5373\u7b2c7\u4f4d\u4e0a\u53bb\u3002<\/p>\n<p>\u901a\u8fc7\u8fd9\u4e24\u79cd\u8ba1\u7b97\u65b9\u5f0f\u5927\u5bb6\u53ef\u4ee5\u6e05\u6670\u7684\u770b\u5230\uff0c\u4f4d\u64cd\u4f5c\u7684GETBIT\u548cSETBIT\u90fd\u662f\u5e38\u91cf\u8ba1\u7b97\uff0c\u56e0\u6b64\u5b83\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3aO(1)\u3002<\/p>\n<p>\u800cBITCOUNT\u547d\u4ee4\u9700\u8981\u5bf9\u6574\u4e2a\u4f4d\u6570\u7ec4\u7684\u6240\u6709\u5143\u7d20\u8fdb\u884c\u904d\u5386\u7b97\u51fa\u503c\u4e3a1\u7684\u6709\u591a\u5c11\u4e2a\uff0c\u5f53\u7136redis\u5bf9\u4e8e\u5927\u6570\u636e\u4e86\u7684bit\u6267\u884cbitcount\u547d\u4ee4\u4f1a\u6709\u4e00\u6574\u5957\u590d\u6742\u7684\u4f18\u5316\u7684\u7b97\u6cd5\uff0c\u4f46\u662f\u6838\u5fc3\u601d\u8def\u8fd8\u662f\u8fd9\u4e2a\u610f\u601d\uff0c\u65e0\u975e\u662f\u51cf\u5c11\u90e8\u5206\u904d\u5386\u67e5\u8be2\u6b21\u6570\u3002\u6bd4\u5982\u4ee5128\u4f4d\u4e3a\u4e00\u6b21\u904d\u5386\uff0c\u90a3\u4e48\u4ed6\u7684\u904d\u5386\u6b21\u6570\u5c31\u662f\u6240\u6709\u7684\u4f4d\u6570\u9664\u4ee5128\u3002<\/p>\n<p>BITTOP\u547d\u4ee4\u5219\u662f\u6839\u636e\u4e0d\u540c\u7684\u64cd\u4f5c\u6709\u4e0d\u540c\u7684\u6267\u884c\u65b9\u5f0f\u3002\u6bd4\u5982AND\u64cd\u4f5c\uff0c\u5219\u9700\u8981\u67e5\u770b\u4f4d\u503c\u4e3a1\u7684\u5373\u53ef\u3002<\/p>\n<p><strong>\u5b58\u50a8\u7a7a\u95f4\u8ba1\u7b97<\/strong><\/p>\n<p>\u6839\u636e\u4e0a\u9762\u7684\u4ecb\u7ecd\uff0c\u76f8\u4fe1\u5927\u5bb6\u5df2\u7ecf\u77e5\u9053\u4e86\u57fa\u4e8eredis\u7684\u4f4d\u6570\u7ec4\u6570\u636e\u7ed3\u6784\u5b58\u50a8\u7684\u6570\u636e\u5360\u7528\u5185\u5b58\u5927\u5c0f\u662f\u600e\u4e48\u8ba1\u7b97\u7684\u4e86\u3002\u6bd4\u5982\u6709100\u4ebf\u7684\u6570\u636e\uff0c\u90a3\u4e48\u5b83\u9700\u8981\u7684\u5b57\u8282\u6570\u7ec4\uff1a<\/p>\n<p>1000000000\u00f78\u00f71024\u00f71024\u2248119.21MB<\/p>\n<p>\u4e5f\u5c31\u662f\u5b58\u50a810\u4ebf\u7684\u6570\u636e\u53ea\u9700\u8981119MB\u5de6\u53f3\u7684\u5185\u5b58\u7a7a\u95f4\uff0c\u8fd9\u5bf9\u4e8e\u73b0\u5728\u52a8\u8f8416G\u300132G\u96c6\u7fa4\u7248\u7684redis\uff0c\u5b8c\u5168\u6ca1\u6709\u95ee\u9898\u3002<\/p>\n<p>\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u5982\u679c\u4f60\u7684\u6570\u636e\u91cf\u4e0d\u5927\uff0c\u90a3\u5c31\u4e0d\u8981\u628a\u8d77\u59cb\u504f\u79fb\u91cf\u641e\u7684\u5f88\u5927\uff0c\u8fd9\u6837\u4e5f\u662f\u5360\u7a7a\u95f4\u7684\uff0c\u6bd4\u5982\u6211\u4eec\u53ea\u9700\u8981\u5b58\u50a8\u51e0\u767e\u6761\u6570\u636e\uff0c\u4f46\u662f\u5176\u4e2d\u7684\u504f\u79fb\u91cf\u5374\u5f88\u5927\uff0c\u8fd9\u5c31\u4f1a\u9020\u6210\u4e86\u5f88\u5927\u7684\u5185\u5b58\u7a7a\u95f4\u6d6a\u8d39\u3002<\/p>\n<p><strong>\u5e94\u7528\u573a\u666f<\/strong><\/p>\n<p>\u5b9e\u9645\u9879\u76ee\u5f00\u53d1\u4e2d\u6709\u5f88\u591a\u4e1a\u52a1\u90fd\u9002\u5408\u91c7\u7528redis\u7684bit\u6765\u5b9e\u73b0\u3002<\/p>\n<p><strong>\u7528\u6237\u7b7e\u5230\u573a\u666f<\/strong><\/p>\n<p>\u6bcf\u5929\u7684\u65e5\u671f\u5b57\u7b26\u4e32\u4f5c\u4e3a\u4e00\u4e2akey\uff0c\u7528\u6237Id\u4f5c\u4e3aoffset\uff0c\u7edf\u8ba1\u6bcf\u5929\u7528\u6237\u7684\u7b7e\u5230\u60c5\u51b5\uff0c\u603b\u7684\u7528\u6237\u7b7e\u5230\u6570<\/p>\n<p><strong>\u6d3b\u8dc3\u7528\u6237\u6570\u7edf\u8ba1<\/strong><\/p>\n<p>\u7528\u6237\u65e5\u6d3b\u3001\u6708\u6d3b\u3001\u7559\u5b58\u7387\u7b49\u5747\u53ef\u4ee5\u7528redis\u4f4d\u6570\u7ec4\u6765\u5b58\u50a8\uff0c\u8fd8\u662f\u4ee5\u6bcf\u5929\u7684\u65e5\u671f\u4f5c\u4e3akey\uff0c\u7528\u6237\u6d3b\u8dc3\u4e86\u5c31\u5199\u5165offset\u4e3a\u7528\u6237id\u7684\u4f4d\u503c1\u3002<\/p>\n<p>\u540c\u7406\u6708\u6d3b\u4e5f\u662f\u5982\u6b64\u3002<\/p>\n<p><strong>\u7528\u6237\u662f\u5426\u5728\u7ebf\u4ee5\u53ca\u603b\u5728\u7ebf\u4eba\u6570\u7edf\u8ba1<\/strong><\/p>\n<p>\u540c\u6837\u662f\u4f7f\u7528\u4e00\u4e2a\u4f4d\u6570\u7ec4\uff0c\u7528\u6237\u7684id\u6620\u5c04\u504f\u79fb\u91cf\uff0c\u5728\u7ebf\u6807\u8bc6\u4e3a1\uff0c\u4e0b\u7ebf\u6807\u8bc6\u4e3a0\u3002\u5373\u53ef\u5b9e\u73b0\u7528\u6237\u4e0a\u4e0b\u7ebf\u67e5\u8be2\u548c\u603b\u5728\u7ebf\u4eba\u6570\u7684\u7edf\u8ba1<\/p>\n<p><strong>APP\u5185\u7528\u6237\u7684\u5168\u5c40\u6d88\u606f\u63d0\u793a\u5c0f\u7ea2\u70b9<\/strong><\/p>\n<p>\u73b0\u5728\u5927\u591a\u6570\u7684APP\u91cc\u90fd\u6709\u7ad9\u5185\u4fe1\u7684\u529f\u80fd\uff0c\u5f53\u6709\u6d88\u606f\u7684\u65f6\u5019\uff0c\u5219\u63d0\u793a\u4e00\u4e2a\u5c0f\u7ea2\u70b9\uff0c\u4ee3\u8868\u7528\u6237\u6709\u65b0\u7684\u6d88\u606f\u3002&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e3a\u5565Redis10\u4ebf\u6570\u636e\u91cf\u53ea\u89811&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-201563","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/201563","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=201563"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/201563\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=201563"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=201563"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=201563"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}