{"id":123,"date":"2017-06-29T15:07:49","date_gmt":"2017-06-29T07:07:49","guid":{"rendered":"http:\/\/www.myway5.com\/?p=123"},"modified":"2018-04-16T14:33:36","modified_gmt":"2018-04-16T06:33:36","slug":"timeline-design","status":"publish","type":"post","link":"https:\/\/www.myway5.com\/index.php\/2017\/06\/29\/timeline-design\/","title":{"rendered":"\u670b\u53cb\u5708\u5f0f\u7684Timeline\u8bbe\u8ba1\u65b9\u6848"},"content":{"rendered":"<h2>\u4e00\u3001\u524d\u8a00<\/h2>\n<p>\u51e0\u4e4e\u6bcf\u4e2a\u4eba\u90fd\u4f1a\u53d1\u670b\u53cb\u5708\u3001\u5fae\u535a\uff0c\u4e00\u4e2a\u770b\u4f3c\u7b80\u5355\u7684\u53d1\u5e03\u529f\u80fd\uff0c\u5b9e\u9645\u5728\u80cc\u540e\u662f\u7ecf\u8fc7\u7cbe\u7ec6\u8bbe\u8ba1\u7684\u7ec4\u7ec7\u67b6\u6784\u3002<a href=\"http:\/\/www.infoq.com\/cn\/presentations\/ywh-build-high-performance-weibo\">\u8fd9\u91cc\u6709\u4e00\u7bc7\u5173\u4e8e\u65b0\u6d6a\u5fae\u535a\u7684\u67b6\u6784\u8bbe\u8ba1\u7684\u6f14\u8bb2<\/a>\uff0c\u4e3b\u8981\u662f\u8bb2\u4e86\u901a\u8fc7redis+\u7f13\u5b58\u7684\u4f7f\u7528\uff0c\u6765\u5b9e\u73b0\u53d1\u5fae\u535a\u7684\u5b9e\u65f6\u6027\u548c\u9ad8\u6548\u6027\u3002<\/p>\n<h2>\u4e8c\u3001Timeline<\/h2>\n<p>\u76ee\u524d\u6765\u8bf4\uff0c\u5927\u591a\u6570\u53d1\u670b\u53cb\u5708\u3001\u53d1\u5fae\u535a\u8fd9\u79cd\u67b6\u6784\u7684\u8bbe\u8ba1\u90fd\u662fTimeline\u7684\u65b9\u5f0f\u3002\u4ee5\u5fae\u535a\u4e3a\u4f8b\uff0c\u6bcf\u4e2a\u7528\u6237\u90fd\u6709\u4e00\u4e2a\u81ea\u5df1\u7684Timeline\uff0c\u7528\u6237\u67e5\u770b\u5fae\u535a\u65f6\uff0c\u53ea\u4ece\u81ea\u5df1\u7684Timeline\u4e0a\u83b7\u53d6\u6570\u636e\u3002\u800c\u5982\u679c\u6211\u4eec\u662f\u4f7f\u7528\u666e\u901a\u7684sql\u67e5\u8be2\uff0c\u90a3\u4e48\u67e5\u8be2\u53ef\u80fd\u5c31\u662f<code>select weibo from table where table.userId in (select userId from guanzhu where guanzhu.userId = 'me')<\/code>\u3002\u4e5f\u5c31\u662f\u5148\u67e5\u8be2\u6211\u6240\u5173\u6ce8\u7684\u4eba\uff0c\u518d\u67e5\u8be2\u6240\u6709\u6211\u5173\u6ce8\u7684\u4eba\u53d1\u7684\u5fae\u535a\uff0c\u7136\u540e\u4ee5\u65f6\u95f4\u6392\u5e8f\u8fd4\u56de\u3002\u800c\u4e14\u56e0\u4e3a\u6570\u636e\u7684\u53d8\u5316\u4f1a\u975e\u5e38\u7684\u5feb\uff0c\u6839\u672c\u6ca1\u6709\u529e\u6cd5\u53bb\u505a\u7f13\u5b58\uff0c\u5e76\u4e14\u5237\u5fae\u535a\u53c8\u662f\u4e00\u4e2a\u975e\u5e38\u9ad8\u9891\u7684\u52a8\u4f5c\uff0c\u56e0\u6b64\u666e\u901a\u7684sql\u67e5\u8be2\u5fc5\u7136\u65e0\u6cd5\u6ee1\u8db3\u3002<\/p>\n<p>\u800cTimeline\u65b9\u6848\uff0c\u5176\u5b9e\u5c31\u662f\u4ee5\u7a7a\u95f4\u6362\u65f6\u95f4\u7684\u4e00\u79cd\u65b9\u6848\uff0c\u5047\u8bbe\u73b0\u5728\u59da\u6668\uff081000\u4e07\u7c89\u4e1d\uff09\u53d1\u5e03\u4e86\u4e00\u6761\u5fae\u535a\uff0c\u5728\u59da\u6668\u7684\u89c6\u89d2\u91cc\uff0c\u5979\u5df2\u7ecf\u53d1\u5e03\u5b8c\u6210\u4e86\uff0c\u4f46\u662f\u5b9e\u9645\u4e0a\u6b64\u65f6\u5e76\u4e0d\u662f\u5979\u7684\u6240\u6709\u7c89\u4e1d\u90fd\u80fd\u7acb\u523b\u770b\u5230\u8fd9\u6761\u5fae\u535a\u3002\u8fd9\u4e2a\u53d1\u5e03\u52a8\u4f5c\u505a\u4e86\u5f02\u6b65\u5904\u7406\uff0c\u6b64\u65f6\u6b63\u5728\u5411\u5173\u6ce8\u5979\u7684\u5fae\u535a\u7684\u7c89\u4e1d\u7684Timeline\u4e0a\u63a8\u9001\uff08\u5f53\u7136\u5fae\u535a\u4e5f\u4e0d\u53ef\u80fd\u771f\u7684\u5411\u5979\u6240\u6709\u7c89\u4e1d\u63a8\u9001\uff0c\u53ef\u80fd\u4f1a\u53bb\u9664\u4e00\u4e9b\u957f\u671f\u4e0d\u4e0a\u7ebf\u7684\u7528\u6237\u4ee5\u53ca\u50f5\u5c38\u7c89\uff09\u3002<\/p>\n<p>\u56e0\u6b64Timeline\u65b9\u6848\u6700\u590d\u6742\u7684\u5730\u65b9\u5c31\u5728\u4e8e\u53d1\u5fae\u535a\u8fd9\u4e2a\u73af\u8282\u800c\u4e0d\u662f\u5237\u65b0\u5fae\u535a\u8fd9\u4e2a\u73af\u8282\u4e86\u3002\u53d1\u5fae\u535a\u76f8\u5bf9\u4e8e\u5237\u65b0\u5fae\u535a\u662f\u975e\u5e38\u4f4e\u9891\u6b21\u7684\uff0c\u5e76\u4e14\u53ea\u8981\u81ea\u5df1\u80fd\u5b9e\u65f6\u770b\u5230\u5c31\u884c\uff0c\u5e76\u4e0d\u8981\u6c42\u5176\u4ed6\u4eba\u90fd\u80fd\u5b9e\u65f6\u770b\u5230\uff0c\u5927\u5927\u964d\u4f4e\u4e86\u590d\u6742\u5ea6\u3002<\/p>\n<h2>\u4e09\u3001\u4f7f\u7528redis\u914d\u5408\u5b8c\u6210Timeline\u7684\u8bbe\u8ba1\u3002<\/h2>\n<p>redis\u662f\u4e00\u6b3e\u5185\u5b58\u6570\u636e\u5e93\uff0c\u4f46\u662f\u5b83\u7684\u6570\u636e\u4e5f\u53ef\u4ee5\u6301\u4e45\u5316\u7684\u78c1\u76d8\u4e0a\u3002\u56e0\u4e3a\u662f\u5185\u5b58\u6570\u636e\u5e93\uff0c\u5b83\u6700\u64c5\u957f\u7684\u5c31\u662f\u9ad8\u9891\u6b21\u7684\u8bfb\u53d6\u548c\u5199\u5165\u3002\u5e76\u4e14redis\u652f\u6301\u591a\u79cd\u6570\u636e\u7ed3\u6784\uff0c\u5176\u4e2dlist\u6570\u636e\u7ed3\u6784\u975e\u5e38\u7b26\u5408Timeline\u7684\u9700\u6c42\u3002<\/p>\n<p>\u5728redis\u4e2d\uff0c\u53ef\u4ee5\u521b\u5efa\u547d\u540d\u7684list\uff08\u7cfb\u7edf\u4e2d\u73b0\u5728\u4f7f\u7528\u4e86zset\u53bb\u4fdd\u5b58timeline\uff0c\u6bd4list\u66f4\u4f18\uff09\uff0c\u5e76\u4e14\u53ef\u4ee5\u5bf9list\u505apush\u3001pop\u3001range\u64cd\u4f5c\u3002\u6bd4\u5982id\u4e3a28\u7684\u7528\u6237\uff0c\u4ed6\u7684timeline\u53ef\u4ee5\u662f\u540d\u4e3au28\u7684list,\u7136\u540e\u4f7f\u7528push\u6765\u5411\u7528\u6237\u7684Timeline\u589e\u52a0\u65b0\u7684\u63a8\u6587\u3001\u4f7f\u7528range\u6765\u83b7\u53d6\u6307\u5b9a\u8303\u56f4\u5185\u7684\u63a8\u6587\u3002<\/p>\n<p>\u4e0b\u9762\u7684php\u4ee3\u7801\u6f14\u793a\u4e86\u5982\u4f55\u4eceTimeline\u4e0a\u83b7\u53d6\u63a8\u6587\u4fe1\u606f<\/p>\n<pre class=\"line-numbers prism-highlight\" data-start=\"1\"><code class=\"language-php\">\/**\n * \u83b7\u53d6\u4e00\u9875\u65f6\u95f4\u8f74\u4e0a\u7684\u63a8\u6587id\n * @param <span class=\"katex math inline\">userId \u7528\u6237id\n * @param<\/span>pageIndex \u9875\u7801\n * @param <span class=\"katex math inline\">pageSize  \u9875\u5927\u5c0f\n * @return array \u4e00\u9875postId\n *\/\npublic function getTimeline(<\/span>userId,<span class=\"katex math inline\">pageIndex,<\/span>pageSize){\n    <span class=\"katex math inline\">end = (1 -<\/span>pageIndex) * <span class=\"katex math inline\">pageSize - 1;<\/span>start = <span class=\"katex math inline\">end -<\/span>pageSize + 1;\n\n    <span class=\"katex math inline\">result =<\/span>this-&gt;redis-&gt;lRange(<span class=\"katex math inline\">this-&gt;getUserTimelineKey(<\/span>userId),<span class=\"katex math inline\">start,<\/span>end);\n\n    return <span class=\"katex math inline\">result;\n}\n\n\/**\n * \u83b7\u53d6\u7528\u6237\u65f6\u95f4\u8f74\u4e0a\u63a8\u6587\u7684\u603b\u6570\n * @param<\/span>userId \u7528\u6237id\n * @return int \u603b\u6570\n *\/\npublic function getTimelinePostCount(<span class=\"katex math inline\">userId){\n    return<\/span>this-&gt;redis-&gt;lSize(<span class=\"katex math inline\">this-&gt;getUserTimelineKey(<\/span>userId));\n}\n\n<\/code><\/pre>\n<h2>\u56db\u3001php\u5982\u4f55\u5f02\u6b65\u63a8\u9001\u5230\u5176\u4ed6\u7528\u6237\u7684Timeline<\/h2>\n<p>php\u7684\u673a\u5236\u51b3\u5b9a\u4e86\u5b83\u65e0\u6cd5\u5b8c\u6210\u5f02\u6b65\u64cd\u4f5c\uff08\u4e00\u4e2aphp\u6587\u4ef6\u6267\u884c\u5b8c\u6210\u4e4b\u540e\u7ebf\u7a0b\u4f1a\u76f4\u63a5\u88ab\u9500\u6bc1\uff09\uff0c\u56e0\u6b64\u8fd9\u91cc\u540c\u6837\u662f\u91c7\u7528\u4e86Redis\u5f53\u505a\u4efb\u52a1\u961f\u5217\u6765\u89e3\u8026\u5408\uff0c\u5b9e\u73b0\u5f02\u6b65\u64cd\u4f5c\u3002\u4e00\u4e2a\u7528\u6237\u53d1\u5e03\u63a8\u6587\u4e4b\u540e\uff0c\u4f7f\u7528\u4e0b\u9762\u7684<code>setPostTask(<span class=\"katex math inline\">pushUserIds,<\/span>postId,$userId)<\/code>\uff0c\u5c06\u53d1\u5e03\u63a8\u6587\u653e\u5230\u4efb\u52a1\u961f\u5217\u4e2d\u7136\u540e\u76f4\u63a5\u8fd4\u56de\u3002\u5728\u8fd9\u91cc\uff0c\u5bf9\u7528\u6237\u81ea\u5df1\u7684Timeline\u505a\u4e86\u7279\u6b8a\u5904\u7406\uff0c\u53d1\u63a8\u6587\u4e4b\u540e\u7acb\u9a6c\u7ed9\u81ea\u5df1\u7684timeline\u540c\u6b65\u63a8\u9001\uff0c\u5176\u4ed6\u7528\u6237\u7684timeline\u662f\u5f02\u6b65\u63a8\u9001\u3002<\/p>\n<pre class=\"line-numbers prism-highlight\" data-start=\"1\"><code class=\"language-php\">        \/**\n         * \u8bbe\u7f6e\u63a8\u9001\u4efb\u52a1\n         * @param <span class=\"katex math inline\">pushUserIds \u8981\u63a8\u9001\u7684userId\n         * @param<\/span>postId      \u63a8\u6587\u5185\u5bb9\n         * @return mix \u4efb\u52a1\u63a8\u9001\u72b6\u6001\n         *\/\n        public function setPostTask(<span class=\"katex math inline\">pushUserIds,<\/span>postId,<span class=\"katex math inline\">userId){\n\n            \/\/\u4e3a\u4e86\u7528\u6237\u7b2c\u4e00\u65f6\u95f4\u770b\u5230\u81ea\u5df1\u53d1\u7684\uff0c\u8fd9\u91cc\u7279\u6b8a\u5904\u7406\u7528\u6237\u81ea\u5df1\u53d1\u7684\u63a8\u6587<\/span>this-&gt;redis-&gt;rPush(<span class=\"katex math inline\">this-&gt;getUserTimelineKey(<\/span>userId),<span class=\"katex math inline\">postId);<\/span>userIds = array();\n            foreach(<span class=\"katex math inline\">pushUserIds as<\/span>value){\n                array_push(<span class=\"katex math inline\">userIds,<\/span>value['userId']);\n            }\n            <span class=\"katex math inline\">data['u'] =<\/span>userIds;\n            <span class=\"katex math inline\">data['p'] =<\/span>postId;\n            <span class=\"katex math inline\">str = \\json_encode(<\/span>data);\n            return <span class=\"katex math inline\">this-&gt;redis-&gt;rPush(<\/span>GLOBALS['redis_post'],$str);\n        }\n<\/code><\/pre>\n<p>\u4e8e\u6b64\u540c\u65f6\uff0c\u4e00\u4e2a\u4ee5cli\u6a21\u5f0f\u8fd0\u884c\u7684php\u811a\u672c\u4ece\u4efb\u52a1\u961f\u5217\u4e2d\u987a\u5e8f\u83b7\u53d6\u6240\u6709\u7684\u63a8\u9001\u4efb\u52a1\uff0c\u5411\u5176\u4ed6\u7528\u6237\u7684Timeline\u4e0a\u63a8\u9001\u3002<\/p>\n<pre class=\"line-numbers prism-highlight\" data-start=\"1\"><code class=\"language-php\">\/**\n * \u83b7\u53d6\u63a8\u9001\u63a8\u6587\u7684\u4efb\u52a1\n * @return mix \u63a8\u9001\u7ed3\u679c\n *\/\npublic function getPostTask(){\n    return <span class=\"katex math inline\">this-&gt;redis-&gt;lPop(<\/span>GLOBALS['redis_post']);\n}\n\n\/**\n * \u5c06\u63a8\u6587id\u63a8\u9001\u5230\u6240\u6709\u7528\u6237\u7684timeline\u4e2d\n * @TODO \u73b0\u5728\u662f\u540c\u6b65\u7684\u65b9\u5f0f\n * @param <span class=\"katex math inline\">pushUserIds \u8981\u63a8\u9001\u7684\u7528\u6237id\n * @param<\/span>postId \u63a8\u6587id\n * @return boolean  true\u64cd\u4f5c\u6210\u529f\n *\/\npublic function pushToTimeline(<span class=\"katex math inline\">pushUserIds,<\/span>postId){\n    foreach(<span class=\"katex math inline\">pushUserIds as<\/span>value){\n        <span class=\"katex math inline\">result =<\/span>this-&gt;redis-&gt;rPush(<span class=\"katex math inline\">this-&gt;getUserTimelineKey(<\/span>value),$postId);\n    }\n    return true;\n}\n<\/code><\/pre>\n<p>cli\u6a21\u5f0f\u8fd0\u884c\u7684php\u811a\u672c\u4ee3\u7801\uff1a<\/p>\n<pre class=\"line-numbers prism-highlight\" data-start=\"1\"><code class=\"language-php\">&lt;?php\n\/**\n * \u4eceRedis\u961f\u5217\u4e2d\u8f6e\u8be2\u8981\u6267\u884c\u7684\u4efb\u52a1\uff0c\u5e76\u6267\u884c\u63a8\u9001\n *\n *\/\nrequire_once('vendor\/autoload.php');\nuse DB\\PostDB;\n\n<span class=\"katex math inline\">postDB = new PostDB();<\/span>postContent = \"\";\nwhile(true){\n\n    while( (<span class=\"katex math inline\">postContent =<\/span>postDB-&gt;getPostTask()) != FALSE ){\n        <span class=\"katex math inline\">post = json_decode(<\/span>postContent,true);\n        var_dump(<span class=\"katex math inline\">post['u']);<\/span>postDB-&gt;pushToTimeline(<span class=\"katex math inline\">post['u'],<\/span>post['p']);\n    }\n\n    sleep(1);\n\n}\n<\/code><\/pre>\n<p>\u5373\u4f7f\u8fd9\u4e2a\u63a8\u9001\u4f1a\u82b1\u8d39\u4e00\u4e9b\u65f6\u95f4\uff0c\u4f46\u662f\u6ca1\u6709\u4efb\u4f55\u7528\u6237\u7684\u4f53\u9a8c\u53d7\u5230\u4e86\u5f71\u54cd\uff0c\u53d1\u5e03\u63a8\u6587\u7684\u7528\u6237timeline\u56e0\u4e3a\u662f\u7279\u6b8a\u5904\u7406\uff0c\u6240\u4ee5\u4ed6\u80fd\u7acb\u9a6c\u770b\u5230\u81ea\u5df1\u53d1\u7684\u63a8\u6587\uff0c\u5176\u4ed6\u7528\u6237\u867d\u7136\u65e0\u6cd5\u7acb\u523b\u770b\u5230\uff0c\u4f46\u662f\u5176\u4ed6\u7528\u6237\u5bf9\u201c\u7acb\u523b\u770b\u5230\u201d\u7684\u9700\u6c42\u51e0\u4e4e\u6ca1\u6709\uff08\u201c\u7acb\u523b\u770b\u5230\u201d\u6307\u7684\u662f\u521a\u53d1\u5e03\u7684\u4e00\u77ac\u95f4\uff0c\u7edd\u5927\u591a\u6570\u4eba\u5bf9\u4e8e\u5ef6\u8fdf\u51e0\u79d2\u770b\u5230\u6839\u672c\u65e0\u6240\u8c13\uff09\u3002\u5e76\u4e14\u8fd9\u4e2a\u67b6\u6784\u53ef\u4ee5\u5f88\u8f7b\u677e\u7684\u6a2a\u5411\u6269\u5c55\u3002<\/p>\n<h2>\u4e94\u3001\u4e00\u4e9b\u5176\u4ed6\u95ee\u9898<\/h2>\n<h3>5.1 \u5185\u5b58\u5f88\u8d35\uff0c\u5c3d\u91cf\u538b\u7f29<\/h3>\n<p>redis\u662f\u5185\u5b58\u6570\u636e\u5e93\uff0c\u5185\u5b58\u76f8\u5bf9\u4e8e\u78c1\u76d8\u7684\u4ef7\u683c\u8981\u8d35\u4e0a\u5f88\u591a\u500d\uff0c\u56e0\u6b64\u5b58\u5728redis\u4e2d\u7684\u5185\u5bb9\u8981\u5c3d\u91cf\u7684\u5c0f\u3002\u6bd4\u5982\u5b58\u7684\u662fJson,\u90a3\u4e48Json\u7684\u5b57\u6bb5\u8981\u5c3d\u91cf\u7684\u5c0f\uff08\u76f4\u63a5\u4f7f\u75281,2,3,4,5\u8fd9\u79cd\u4e5f\u5b8c\u5168\u53ef\u4ee5\uff0c\u5373\u4f7f\u635f\u5931\u4e86\u53ef\u8bfb\u6027\uff09\uff0c\u540c\u65f6Json\u4e5f\u53ef\u4ee5\u8003\u8651\u6539\u6210\u8c37\u6b4c\u7684Protocol Buffers\u7b49\u7b49\u3002<\/p>\n<h3>5.2 timeline\u91cc\u5e94\u8be5\u5b58\u4ec0\u4e48<\/h3>\n<p>\u4f7f\u7528Redis\u5b58\u50a8\u4e86\u6bcf\u4e2a\u7528\u6237\u7684Timeline\uff0c\u5728\u6211\u7684\u5b9e\u73b0\u4e2d\uff0ctimeline\u4e2d\u5b58\u50a8\u7684\u662f\u6bcf\u7bc7\u63a8\u6587\u7684id\uff0c\u7136\u540e\u83b7\u53d6\u5230id\u4e4b\u540e\u518d\u53bbmysql\u6570\u636e\u5e93\u4e2d\u67e5\u8be2\uff0c\u4f46\u662f\u8fd9\u6837\u7684\u8bbe\u8ba1\u867d\u7136\u5927\u5927\u964d\u4f4e\u4e86\u67e5\u8be2\u7684\u590d\u6742\u5ea6\uff0c\u4f46\u662f\u5e76\u6ca1\u6709\u964d\u4f4emysql\u7684IO\u8d1f\u8377\uff0c\u5982\u679c\u628a\u63a8\u6587\u5185\u5bb9\u76f4\u63a5\u5b58\u50a8\u5230Timeline\u4e2d\u5462\uff1f\u8fd9\u6837\u7684\u8bdd\u5982\u679c\u7528\u6237\u8981\u5220\u9664\u4e00\u7bc7\u63a8\u6587\uff0c\u5982\u4f55\u5bf9\u5e94\u7684\u5220\u9664\u5176\u4ed6\u7528\u6237\u7684timeline\u4e2d\u7684\u63a8\u6587\uff1f\u8fd9\u4e2a\u5730\u65b9\u4e00\u76f4\u662f\u6211\u65e0\u6cd5\u89e3\u51b3\u7684\u7591\u60d1\u3002<\/p>\n<p><a href=\"https:\/\/redislabs.com\/ebook\/part-2-core-concepts\/chapter-8-building-a-simple-social-network\/\">\u8fd9\u91cc\u6709\u4e00\u7bc7\u5173\u4e8etwitter\u4f7f\u7528redis\u89e3\u51b3timeline\u7684\u65b9\u6848<\/a>\uff0c\u8fd9\u7bc7\u65b9\u6848\u4e2d\u4f7f\u7528\u7684\u4e0d\u662flist\u6765\u4fdd\u5b58\u7528\u6237\u7684post\uff0c\u800c\u662fzset\uff0czset\u4e2d\u6bcf\u6761\u6570\u636e\u7531\u63a8\u6587\u7684id\u548c\u65f6\u95f4\u6233\u7ec4\u6210\uff0c\u901a\u8fc7\u65f6\u95f4\u6765\u6392\u5e8f\u3002\u4ed4\u7ec6\u8003\u8651\u4e00\u4e0b\uff0clist\u56e0\u4e3a\u662f\u6839\u636e\u63a8\u9001\u65f6\u95f4\u6765\u6392\u5e8f\u7684\uff0c\u53ef\u80fd\u51fa\u73b0\u540e\u53d1\u7684\u63a8\u6587\u51fa\u73b0\u5728\u9760\u524d\u7684\u4f4d\u7f6e\uff08\u5f53\u7136\u6211\u8ba4\u4e3a\u662f\u53ef\u4ee5\u901a\u8fc7\u9690\u85cf\u63cf\u8ff0\u663e\u793a\u6765\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u56e0\u4e3a\u9519\u4f4d\u51e0\u79d2\u5e76\u4e0d\u5f71\u54cd\uff09\u3002<\/p>\n<p>\u6240\u4ee5\u7406\u8bba\u4e0a\u6765\u8bf4\uff0c\u4e0a\u9762\u90a3\u7bc7\u6587\u7ae0\u4ecb\u7ecd\u7684\u65b9\u6848\u548c\u6211\u7684\u65b9\u6848\u662f\u4e00\u81f4\u7684\uff0c\u53ea\u662f\u6211\u628a\u63a8\u6587\u7684\u6e90\u653e\u5728mysql\u4e0a\uff0ctwitter\u76f4\u63a5\u662f\u5b58\u50a8\u5728redis\u4e2d\u6765\u83b7\u53d6\u66f4\u5feb\u7684\u901f\u5ea6\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u524d\u8a00 \u51e0\u4e4e\u6bcf\u4e2a\u4eba\u90fd\u4f1a\u53d1\u670b\u53cb\u5708\u3001\u5fae\u535a\uff0c\u4e00\u4e2a\u770b\u4f3c\u7b80\u5355\u7684\u53d1\u5e03\u529f\u80fd\uff0c\u5b9e\u9645\u5728\u80cc\u540e\u662f\u7ecf\u8fc7\u7cbe\u7ec6\u8bbe\u8ba1\u7684\u7ec4\u7ec7\u67b6\u6784\u3002\u8fd9\u91cc\u6709\u4e00\u7bc7 &hellip; <a href=\"https:\/\/www.myway5.com\/index.php\/2017\/06\/29\/timeline-design\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u670b\u53cb\u5708\u5f0f\u7684Timeline\u8bbe\u8ba1\u65b9\u6848<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[17,18,16],"class_list":["post-123","post","type-post","status-publish","format-standard","hentry","category-design","tag-redis","tag-timeline","tag-16"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u670b\u53cb\u5708\u5f0f\u7684Timeline\u8bbe\u8ba1\u65b9\u6848 - \u4e00\u53ea\u5b89\u9759\u7684\u732b<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.myway5.com\/index.php\/2017\/06\/29\/timeline-design\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u670b\u53cb\u5708\u5f0f\u7684Timeline\u8bbe\u8ba1\u65b9\u6848 - \u4e00\u53ea\u5b89\u9759\u7684\u732b\" \/>\n<meta property=\"og:description\" content=\"\u4e00\u3001\u524d\u8a00 \u51e0\u4e4e\u6bcf\u4e2a\u4eba\u90fd\u4f1a\u53d1\u670b\u53cb\u5708\u3001\u5fae\u535a\uff0c\u4e00\u4e2a\u770b\u4f3c\u7b80\u5355\u7684\u53d1\u5e03\u529f\u80fd\uff0c\u5b9e\u9645\u5728\u80cc\u540e\u662f\u7ecf\u8fc7\u7cbe\u7ec6\u8bbe\u8ba1\u7684\u7ec4\u7ec7\u67b6\u6784\u3002\u8fd9\u91cc\u6709\u4e00\u7bc7 &hellip; \u7ee7\u7eed\u9605\u8bfb\u670b\u53cb\u5708\u5f0f\u7684Timeline\u8bbe\u8ba1\u65b9\u6848\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.myway5.com\/index.php\/2017\/06\/29\/timeline-design\/\" \/>\n<meta property=\"og:site_name\" content=\"\u4e00\u53ea\u5b89\u9759\u7684\u732b\" \/>\n<meta property=\"article:published_time\" content=\"2017-06-29T07:07:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-04-16T06:33:36+00:00\" \/>\n<meta name=\"author\" content=\"jiangpengfei\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"jiangpengfei\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2017\/06\/29\/timeline-design\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2017\/06\/29\/timeline-design\/\"},\"author\":{\"name\":\"jiangpengfei\",\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"headline\":\"\u670b\u53cb\u5708\u5f0f\u7684Timeline\u8bbe\u8ba1\u65b9\u6848\",\"datePublished\":\"2017-06-29T07:07:49+00:00\",\"dateModified\":\"2018-04-16T06:33:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2017\/06\/29\/timeline-design\/\"},\"wordCount\":79,\"commentCount\":8,\"publisher\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"keywords\":[\"redis\",\"timeline\",\"\u67b6\u6784\"],\"articleSection\":[\"\u67b6\u6784\u8bbe\u8ba1\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.myway5.com\/index.php\/2017\/06\/29\/timeline-design\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2017\/06\/29\/timeline-design\/\",\"url\":\"https:\/\/www.myway5.com\/index.php\/2017\/06\/29\/timeline-design\/\",\"name\":\"\u670b\u53cb\u5708\u5f0f\u7684Timeline\u8bbe\u8ba1\u65b9\u6848 - \u4e00\u53ea\u5b89\u9759\u7684\u732b\",\"isPartOf\":{\"@id\":\"https:\/\/www.myway5.com\/#website\"},\"datePublished\":\"2017-06-29T07:07:49+00:00\",\"dateModified\":\"2018-04-16T06:33:36+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2017\/06\/29\/timeline-design\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.myway5.com\/index.php\/2017\/06\/29\/timeline-design\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2017\/06\/29\/timeline-design\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.myway5.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u670b\u53cb\u5708\u5f0f\u7684Timeline\u8bbe\u8ba1\u65b9\u6848\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.myway5.com\/#website\",\"url\":\"https:\/\/www.myway5.com\/\",\"name\":\"\u4e00\u53ea\u5b89\u9759\u7684\u732b\",\"description\":\"\u60f3\u5565\u5462\",\"publisher\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.myway5.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\",\"name\":\"jiangpengfei\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g\",\"caption\":\"jiangpengfei\"},\"logo\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/www.myway5.com\/index.php\/author\/joyme\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u670b\u53cb\u5708\u5f0f\u7684Timeline\u8bbe\u8ba1\u65b9\u6848 - \u4e00\u53ea\u5b89\u9759\u7684\u732b","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.myway5.com\/index.php\/2017\/06\/29\/timeline-design\/","og_locale":"zh_CN","og_type":"article","og_title":"\u670b\u53cb\u5708\u5f0f\u7684Timeline\u8bbe\u8ba1\u65b9\u6848 - \u4e00\u53ea\u5b89\u9759\u7684\u732b","og_description":"\u4e00\u3001\u524d\u8a00 \u51e0\u4e4e\u6bcf\u4e2a\u4eba\u90fd\u4f1a\u53d1\u670b\u53cb\u5708\u3001\u5fae\u535a\uff0c\u4e00\u4e2a\u770b\u4f3c\u7b80\u5355\u7684\u53d1\u5e03\u529f\u80fd\uff0c\u5b9e\u9645\u5728\u80cc\u540e\u662f\u7ecf\u8fc7\u7cbe\u7ec6\u8bbe\u8ba1\u7684\u7ec4\u7ec7\u67b6\u6784\u3002\u8fd9\u91cc\u6709\u4e00\u7bc7 &hellip; \u7ee7\u7eed\u9605\u8bfb\u670b\u53cb\u5708\u5f0f\u7684Timeline\u8bbe\u8ba1\u65b9\u6848","og_url":"https:\/\/www.myway5.com\/index.php\/2017\/06\/29\/timeline-design\/","og_site_name":"\u4e00\u53ea\u5b89\u9759\u7684\u732b","article_published_time":"2017-06-29T07:07:49+00:00","article_modified_time":"2018-04-16T06:33:36+00:00","author":"jiangpengfei","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"jiangpengfei","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.myway5.com\/index.php\/2017\/06\/29\/timeline-design\/#article","isPartOf":{"@id":"https:\/\/www.myway5.com\/index.php\/2017\/06\/29\/timeline-design\/"},"author":{"name":"jiangpengfei","@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"headline":"\u670b\u53cb\u5708\u5f0f\u7684Timeline\u8bbe\u8ba1\u65b9\u6848","datePublished":"2017-06-29T07:07:49+00:00","dateModified":"2018-04-16T06:33:36+00:00","mainEntityOfPage":{"@id":"https:\/\/www.myway5.com\/index.php\/2017\/06\/29\/timeline-design\/"},"wordCount":79,"commentCount":8,"publisher":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"keywords":["redis","timeline","\u67b6\u6784"],"articleSection":["\u67b6\u6784\u8bbe\u8ba1"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.myway5.com\/index.php\/2017\/06\/29\/timeline-design\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.myway5.com\/index.php\/2017\/06\/29\/timeline-design\/","url":"https:\/\/www.myway5.com\/index.php\/2017\/06\/29\/timeline-design\/","name":"\u670b\u53cb\u5708\u5f0f\u7684Timeline\u8bbe\u8ba1\u65b9\u6848 - \u4e00\u53ea\u5b89\u9759\u7684\u732b","isPartOf":{"@id":"https:\/\/www.myway5.com\/#website"},"datePublished":"2017-06-29T07:07:49+00:00","dateModified":"2018-04-16T06:33:36+00:00","breadcrumb":{"@id":"https:\/\/www.myway5.com\/index.php\/2017\/06\/29\/timeline-design\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.myway5.com\/index.php\/2017\/06\/29\/timeline-design\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.myway5.com\/index.php\/2017\/06\/29\/timeline-design\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.myway5.com\/"},{"@type":"ListItem","position":2,"name":"\u670b\u53cb\u5708\u5f0f\u7684Timeline\u8bbe\u8ba1\u65b9\u6848"}]},{"@type":"WebSite","@id":"https:\/\/www.myway5.com\/#website","url":"https:\/\/www.myway5.com\/","name":"\u4e00\u53ea\u5b89\u9759\u7684\u732b","description":"\u60f3\u5565\u5462","publisher":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.myway5.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685","name":"jiangpengfei","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.myway5.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f8c7de757f6e0247412bcfd31b7c2271?s=96&d=monsterid&r=g","caption":"jiangpengfei"},"logo":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/image\/"},"url":"https:\/\/www.myway5.com\/index.php\/author\/joyme\/"}]}},"views":16122,"_links":{"self":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/123","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/comments?post=123"}],"version-history":[{"count":7,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/123\/revisions"}],"predecessor-version":[{"id":299,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/123\/revisions\/299"}],"wp:attachment":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/media?parent=123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/categories?post=123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/tags?post=123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}