{"id":116235,"date":"2026-10-21T00:16:34","date_gmt":"2026-10-20T16:16:34","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/116235.html"},"modified":"2026-10-21T00:16:34","modified_gmt":"2026-10-20T16:16:34","slug":"%e9%ab%98%e5%b9%b6%e5%8f%91%e5%9c%ba%e6%99%af%e4%b8%8b%e7%9a%84%e6%9c%ac%e5%9c%b0%e7%bc%93%e5%ad%98%e8%bf%9b%e5%8c%96%e8%ae%ba%ef%bc%9a%e4%bb%8e-go-sync-map-%e5%88%b0-bigcache-%e7%9a%84%e6%80%a7","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/116235.html","title":{"rendered":"\u9ad8\u5e76\u53d1\u573a\u666f\u4e0b\u7684\u672c\u5730\u7f13\u5b58\u8fdb\u5316\u8bba\uff1a\u4ece Go sync.Map \u5230 BigCache \u7684\u6027\u80fd\u8c03\u4f18\u5b9e\u8df5"},"content":{"rendered":"<p>        \/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/<br \/>\n        #content_views .toc,<br \/>\n        \/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/<br \/>\n        #content_views.markdown_views &gt; p:empty:has(+ .toc),<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty,<br \/>\n        \/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/<br \/>\n        #content_views.htmledit_views #main-toc,<br \/>\n        #content_views.htmledit_views #hr-toc,<br \/>\n        #content_views.htmledit_views p[id*=\\&#8221;-toc\\&#8221;] {<br \/>\n          display: none !important;<br \/>\n        }<br \/>\n        \/* \u76ee\u5f55\u53bb\u6389\u540e\uff0c\u7d27\u8ddf\u7684\u9996\u4e2a\u6807\u9898\u4e0d\u518d\u591a\u51fa\u4e00\u5757\u4e0a\u8fb9\u8ddd *\/<br \/>\n        #content_views.markdown_views &gt; .toc + h1,<br \/>\n        #content_views.markdown_views &gt; .toc + h2,<br \/>\n        #content_views.markdown_views &gt; .toc + h3,<br \/>\n        #content_views.markdown_views &gt; .toc + h4,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h1,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h2,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h3,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h4 {<br \/>\n          margin-top: 0 !important;<br \/>\n        }<\/p>\n<h4><\/h4>\n<p>\u5728 Golang \u5f00\u53d1\u7684\u9ad8\u5e76\u53d1\u670d\u52a1\u4e2d&#xff0c;\u7f13\u5b58\u662f\u63d0\u5347\u7cfb\u7edf\u541e\u5410\u91cf\u3001\u964d\u4f4e\u6570\u636e\u5e93\u538b\u529b\u7684\u5229\u5668\u3002\u8bb8\u591a\u5f00\u53d1\u8005\u5728\u9762\u5bf9\u672c\u5730\u7f13\u5b58\u9700\u6c42\u65f6&#xff0c;\u5f80\u5f80\u4f18\u5148\u9009\u62e9\u6807\u51c6\u5e93\u63d0\u4f9b\u7684 sync.Map\u3002\u7136\u800c&#xff0c;\u968f\u7740\u5e76\u53d1\u91cf\u7206\u53d1\u4e0e\u6570\u636e\u89c4\u6a21\u6fc0\u589e&#xff0c;sync.Map \u5e38\u5e38\u56e0\u9501\u7ade\u4e89\u4e0e\u5783\u573e\u56de\u6536&#xff08;GC&#xff09;\u538b\u529b\u6210\u4e3a\u7cfb\u7edf\u74f6\u9888\u3002\u672c\u6587\u5c06\u6df1\u5165\u5256\u6790 Go \u672c\u5730\u7f13\u5b58\u7684\u6280\u672f\u6f14\u8fdb&#xff0c;\u5bf9\u6bd4 sync.Map\u3001\u5206\u7247\u9501\u65b9\u6848&#xff0c;\u5e76\u7ed3\u5408\u6e90\u7801\u89e3\u6790\u9ad8\u6027\u80fd\u672c\u5730\u7f13\u5b58\u5e93 BigCache \u7684\u96f6 GC \u4f18\u5316\u673a\u5236\u3002<\/p>\n<h4><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"899\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020161632-6ad793e0deea3.png\" width=\"1456\" \/><\/h4>\n<h4>\u4e00\u3001 \u4e3a\u4ec0\u4e48 sync.Map \u65e0\u6cd5\u6253\u6ee1\u9ad8\u5e76\u53d1\u573a\u666f&#xff1f;<\/h4>\n<p>\u5728\u8f7b\u91cf\u7ea7\u5e76\u53d1\u573a\u666f\u4e0b&#xff0c;Go \u6807\u51c6\u5e93\u7684 sync.Map \u51ed\u501f\u5176\u7b80\u5355\u6613\u7528\u7684\u63a5\u53e3\u88ab\u5e7f\u6cdb\u4f7f\u7528\u3002\u5b83\u7684\u6838\u5fc3\u8bbe\u8ba1\u5728\u4e8e\u8bfb\u5199\u5206\u79bb&#xff1a;\u5185\u7f6e read&#xff08;\u53ea\u8bfb\u539f\u5b50\u6307\u9488&#xff09;\u4e0e dirty&#xff08;\u52a0\u9501\u8bfb\u5199 Map&#xff09;\u4e24\u4e2a\u7ed3\u6784\u3002<\/p>\n<h5>1. sync.Map \u7684\u4f18\u52bf\u75db\u70b9\u5256\u6790<\/h5>\n<ul>\n<li>\n<p>\u9002\u7528\u573a\u666f&#xff1a;\u8bfb\u6781\u591a\u3001\u5199\u6781\u5c11&#xff08;Read-Heavy&#xff09;&#xff0c;\u6216\u8005\u8bfb\u5199\u952e\u96c6\u5408\u57fa\u672c\u91cd\u53e0\u7684\u573a\u666f\u3002\u6b64\u65f6\u547d\u4e2d read \u53d8\u91cf\u65e0\u9700\u52a0\u9501&#xff0c;\u6027\u80fd\u63a5\u8fd1\u539f\u751f Map\u3002<\/p>\n<\/li>\n<li>\n<p>\u9ad8\u5e76\u53d1\u5199\u7684\u81f4\u547d\u5f31\u70b9&#xff1a;<\/p>\n<li>\n<p>\u9501\u7ade\u4e89\u6fc0\u70c8&#xff1a;\u4e00\u65e6\u53d1\u751f\u5927\u91cf\u7684\u5199\u5165\u6216\u66f4\u65b0&#xff0c;\u8bf7\u6c42\u4f1a\u9891\u7e41\u51fb\u7a7f read \u964d\u7ea7\u5230 dirty&#xff0c;\u89e6\u53d1 mu Mutex \u4e92\u65a5\u9501&#xff0c;\u5bfc\u81f4 CPU \u65f6\u95f4\u7247\u5927\u91cf\u6d88\u8017\u5728\u9501\u7b49\u5f85\u4e0a\u3002<\/p>\n<\/li>\n<li>\n<p>\u5185\u5b58\u7ffb\u500d\u4e0e\u590d\u5236&#xff1a;\u5f53 dirty \u5347\u7ea7\u4e3a read \u65f6&#xff0c;\u9700\u8981\u5bf9\u5e95\u5c42 Map \u8fdb\u884c\u63d0\u5347\u4e0e\u590d\u5236&#xff0c;\u9020\u6210\u4e0d\u5fc5\u8981\u7684\u5185\u5b58\u5f00\u9500\u3002<\/p>\n<\/li>\n<\/li>\n<\/ul>\n<h5>2. GC \u626b\u63cf\u5e26\u6765\u7684\u7269\u7406\u5361\u987f<\/h5>\n<p>\u65e0\u8bba\u662f sync.Map \u8fd8\u662f Go \u539f\u751f map[string]interface{}&#xff0c;\u5f53 Map \u5185\u90e8\u5b58\u50a8\u7684 Key-Value \u8282\u70b9\u6570\u91cf\u8fbe\u5230\u767e\u4e07\u7ea7\u4ee5\u4e0a\u65f6&#xff0c;Go \u7684\u4e09\u8272\u6807\u8bb0\u5783\u573e\u56de\u6536\u5668&#xff08;GC&#xff09;\u5fc5\u987b\u904d\u5386 Map \u4e2d\u7684\u6bcf\u4e00\u4e2a\u6307\u9488\u3002\u8fd9\u4f1a\u5bfc\u81f4 STW&#xff08;Stop The World&#xff09;\u65f6\u95f4\u548c GC \u626b\u63cf\u8017\u65f6\u6025\u5267\u4e0a\u5347\u3002<\/p>\n<h4>\u4e8c\u3001 \u8fdb\u9636\u6f14\u8fdb&#xff1a;\u5206\u7247\u9501&#xff08;Sharded Map&#xff09;\u67b6\u6784<\/h4>\n<p>\u4e3a\u4e86\u89e3\u51b3\u5355\u4e2a\u4e92\u65a5\u9501\u7684\u7ade\u4e89\u95ee\u9898&#xff0c;\u4e1a\u754c\u5e38\u7528\u7684\u8fc7\u6e21\u65b9\u6848\u662f\u5206\u7247\u9501&#xff08;Sharding&#xff09;&#xff0c;\u4f8b\u5982\u5f00\u6e90\u5e93 orcaman\/concurrent-map \u7684\u5b9e\u73b0\u7b56\u7565\u3002<\/p>\n<p>                       &#043;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&#043;<br \/>\n                       |    Hash(Key)      |<br \/>\n                       &#043;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&#043;<br \/>\n                                 |<br \/>\n                  &#043;&#8212;&#8212;&#8212;&#8212;&#8211;&#043;&#8212;&#8212;&#8212;&#8212;&#8211;&#043;<br \/>\n                  |                             |<br \/>\n                  v                             v<br \/>\n       &#043;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&#043;        &#043;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&#043;<br \/>\n       |  Shard 0           |        |  Shard N           |<br \/>\n       |  RWMutex &#043; Map     |        |  RWMutex &#043; Map     |<br \/>\n       &#043;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&#043;        &#043;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&#043;<\/p>\n<ul>\n<li>\n<p>\u6838\u5fc3\u539f\u7406&#xff1a;\u5c06\u5927 Map \u5747\u5300\u62c6\u5206\u4e3a $N$ \u4e2a\u72ec\u7acb\u7684\u5b50 Map&#xff08;Shard&#xff09;&#xff0c;\u6bcf\u4e2a Shard \u62e5\u6709\u4e00\u628a\u72ec\u7acb\u7684 sync.RWMutex\u3002<\/p>\n<\/li>\n<li>\n<p>\u6548\u679c&#xff1a;\u8ba1\u7b97 Key \u7684 Hash \u503c\u53d6\u6a21\u5206\u914d\u5230\u5bf9\u5e94 Shard&#xff0c;\u5c06\u5168\u5c40\u9501\u7ade\u4e89\u964d\u4f4e\u5230\u539f\u6765\u7684 $1\/N$\u3002<\/p>\n<\/li>\n<li>\n<p>\u5c40\u9650&#xff1a;\u5c3d\u7ba1\u89e3\u51b3\u4e86\u9501\u7ade\u4e89&#xff0c;\u4f46\u5e95\u5c42\u4f9d\u7136\u662f\u666e\u901a\u7684\u6307\u9488\u578b Map&#xff0c;\u767e\u4e07\u7ea7 Key \u5e26\u6765\u7684 GC \u626b\u63cf\u538b\u529b\u4f9d\u7136\u6ca1\u6709\u89e3\u51b3\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>\u4e09\u3001 \u6781\u81f4\u6027\u80fd&#xff1a;BigCache \u7684\u201c\u96f6 GC\u201d\u4e0e\u65e0\u9501\u4f18\u5316<\/h4>\n<p>\u5f53\u7cfb\u7edf\u6570\u636e\u91cf\u8fbe\u5230\u5343\u4e07\u7ea7&#xff0c;\u4e14\u5bf9\u5ef6\u8fdf\u8981\u6c42\u5728\u6beb\u79d2\u751a\u81f3\u5fae\u79d2\u7ea7\u65f6&#xff0c;BigCache \u6210\u4e3a\u4e86 Golang \u672c\u5730\u7f13\u5b58\u7684\u9996\u9009\u65b9\u6848\u3002<\/p>\n<h5>1. \u7ed5\u8fc7 GC \u7684\u9ed1\u79d1\u6280&#xff1a;\u975e\u6307\u9488 Map<\/h5>\n<p>Go \u8bed\u8a00\u7684 GC \u5728\u626b\u63cf Map \u65f6\u5b58\u5728\u4e00\u4e2a\u4f18\u5316\u7279\u6027&#xff1a;\u5982\u679c Map \u7684 Key \u548c Value \u90fd\u4e0d\u5305\u542b\u6307\u9488&#xff08;\u4f8b\u5982 map[int]int \u6216 map[uint32]uint32&#xff09;&#xff0c;GC \u5c31\u4f1a\u5b8c\u5168\u8df3\u8fc7\u5bf9\u8be5 Map \u5185\u90e8\u5143\u7d20\u7684\u9012\u5f52\u626b\u63cf\u3002<\/p>\n<p>BigCache \u5145\u5206\u5229\u7528\u4e86\u8fd9\u4e00\u70b9&#xff0c;\u5c06\u5176\u5e95\u5c42\u7ed3\u6784\u8bbe\u8ba1\u4e3a&#xff1a;<\/p>\n<p>Go<\/p>\n<\/p>\n<p>type cacheShard struct {<br \/>\n    \/\/ key: Key \u7684 64 \u4f4d\u54c8\u5e0c\u503c (\u65e0\u6307\u9488)<br \/>\n    \/\/ value: \u6570\u636e\u5728\u73af\u5f62 byte \u6570\u7ec4\u4e2d\u7684\u504f\u79fb\u91cf (\u65e0\u6307\u9488)<br \/>\n    hashmap     map[uint64]uint32<br \/>\n    entries     BytesQueue \/\/ \u8fde\u7eed\u7684\u5b57\u8282\u6570\u7ec4<br \/>\n    lock        sync.RWMutex<br \/>\n    \/\/ &#8230;<br \/>\n}<\/p>\n<h5>2. \u73af\u5f62\u5b57\u8282\u6570\u7ec4&#xff08;BytesQueue&#xff09;\u5185\u5b58\u5e03\u5c40<\/h5>\n<p>BigCache \u5c06\u6240\u6709\u771f\u6b63\u7684\u6570\u636e&#xff08;Key\u3001Value\u3001\u65f6\u95f4\u6233\u7b49\u5143\u6570\u636e&#xff09;\u5e8f\u5217\u5316\u4e3a\u5b57\u8282\u6d41&#xff0c;\u8fde\u7eed\u8ffd\u52a0\u5199\u5165\u5230\u4e00\u4e2a\u5de8\u5927\u7684 []byte \u5207\u7247\u4e2d\u3002<\/p>\n<p>Entries Queue (\u5927\u5b57\u8282\u5207\u7247):<br \/>\n&#043;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&#043;<br \/>\n| Size (4B) | Timestamp (8B) | KeyHash (8B) | Key | Value | &#8230;     |<br \/>\n&#043;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&#043;<br \/>\n^                                                   ^<br \/>\n|&#8212; \u5934\u90e8 (Oldest)                                  |&#8212; \u5c3e\u90e8 (Newest)<\/p>\n<ul>\n<li>\n<p>\u5199\u64cd\u4f5c&#xff1a;\u5c06\u6570\u636e\u8ffd\u52a0\u5230 BytesQueue \u672b\u5c3e&#xff0c;\u5e76\u5728 map[uint64]uint32 \u4e2d\u8bb0\u5f55\u5176\u8d77\u59cb Index\u3002<\/p>\n<\/li>\n<li>\n<p>\u8bfb\u64cd\u4f5c&#xff1a;\u901a\u8fc7 KeyHash \u67e5\u627e\u5230 Index&#xff0c;\u76f4\u63a5\u53bb BytesQueue \u7684\u5bf9\u5e94\u5185\u5b58\u5730\u5740\u5207\u7247\u8bfb\u53d6\u6570\u636e&#xff0c;\u53cd\u5e8f\u5217\u5316\u8fd4\u56de\u3002<\/p>\n<\/li>\n<li>\n<p>GC \u8868\u73b0&#xff1a;\u4e0d\u8bba\u7f13\u5b58\u4e86\u591a\u5c11 G \u7684\u6570\u636e&#xff0c;\u5bf9 GC \u800c\u8a00\u53ea\u770b\u5230\u4e00\u4e2a map[uint64]uint32 \u548c\u4e00\u4e2a\u8d85\u5927\u7684 []byte&#xff0c;\u626b\u63cf\u8017\u65f6\u76f4\u63a5\u7f29\u51cf\u81f3\u5fae\u79d2\u7ea7\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>\u56db\u3001 \u5e38\u7528\u672c\u5730\u7f13\u5b58\u65b9\u6848\u5bf9\u6bd4\u4e0e\u9009\u578b\u6307\u5357<\/h4>\n<p>\u5728\u5b9e\u9645\u4e1a\u52a1\u5f00\u53d1\u4e2d&#xff0c;\u6211\u4eec\u5e94\u5f53\u6839\u636e\u6570\u636e\u91cf\u7ea7\u4e0e\u8bfb\u5199\u6a21\u5f0f\u8fdb\u884c\u7cbe\u51c6\u9009\u578b&#xff1a;<\/p>\n<table>\n<tr>\n<td>\u7ef4\u5ea6<\/td>\n<td>sync.Map<\/td>\n<td>concurrent-map (\u5206\u7247\u9501)<\/td>\n<td>BigCache<\/td>\n<td>FreeCache<\/td>\n<\/tr>\n<tbody>\n<tr>\n<td>\u5e95\u5c42\u6570\u636e\u7ed3\u6784<\/td>\n<td>Read\/Dirty \u53cc Map<\/td>\n<td>\u5206\u7247 RWMutex &#043; Map<\/td>\n<td>\u5206\u7247 map[uint64]uint32 &#043; []byte<\/td>\n<td>\u81ea\u5b9a\u4e49\u73af\u5f62 RingBuffer<\/td>\n<\/tr>\n<tr>\n<td>GC \u626b\u63cf\u5f00\u9500<\/td>\n<td>\u9ad8&#xff08;\u968f\u8282\u70b9\u6570\u7ebf\u6027\u589e\u52a0&#xff09;<\/td>\n<td>\u9ad8&#xff08;\u968f\u8282\u70b9\u6570\u7ebf\u6027\u589e\u52a0&#xff09;<\/td>\n<td>\u6781\u4f4e&#xff08;\u96f6\u6307\u9488\u626b\u63cf&#xff09;<\/td>\n<td>\u6781\u4f4e&#xff08;\u96f6\u6307\u9488\u626b\u63cf&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u5185\u5b58\u5229\u7528\u7387<\/td>\n<td>\u4e2d\u7b49<\/td>\n<td>\u4e2d\u7b49<\/td>\n<td>\u9ad8&#xff08;\u8fde\u7eed\u5185\u5b58\u7d27\u51d1\u5b58\u50a8&#xff09;<\/td>\n<td>\u9ad8<\/td>\n<\/tr>\n<tr>\n<td>\u6dd8\u6c70\u7b56\u7565<\/td>\n<td>\u65e0&#xff08;\u9700\u624b\u52a8\u5220\u9664&#xff09;<\/td>\n<td>\u65e0&#xff08;\u9700\u624b\u52a8\u5220\u9664&#xff09;<\/td>\n<td>\u57fa\u4e8e FIFO \/ TTL<\/td>\n<td>\u57fa\u4e8e RingBuffer \/ TTL<\/td>\n<\/tr>\n<tr>\n<td>\u9002\u7528\u573a\u666f<\/td>\n<td>\u5c11\u91cf Key&#xff0c;\u8bfb\u591a\u5199\u6781\u5c11<\/td>\n<td>\u4e2d\u7b49\u6570\u636e\u91cf&#xff0c;\u9ad8\u5e76\u53d1\u8bfb\u5199<\/td>\n<td>\u6d77\u91cf Key&#xff0c;\u9ad8\u5e76\u53d1&#xff0c;\u5bf9 GC \u654f\u6027\u611f<\/td>\n<td>\u6d77\u91cf Key&#xff0c;\u4e25\u683c\u5185\u5b58\u9650\u5236<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>\u4e94\u3001 \u603b\u7ed3\u4e0e\u6700\u4f73\u5b9e\u8df5<\/h4>\n<li>\n<p>\u5c0f\u89c4\u6a21\/\u8bfb\u591a\u5199\u5c11&#xff1a;\u76f4\u63a5\u4f7f\u7528\u6807\u51c6\u5e93 sync.Map&#xff0c;\u7b80\u5355\u9ad8\u6548&#xff0c;\u65e0\u9700\u5f15\u5165\u989d\u5916\u4f9d\u8d56\u3002<\/p>\n<\/li>\n<li>\n<p>\u4e2d\u7b49\u89c4\u6a21\/\u9700\u5e76\u53d1\u8bfb\u5199&#xff1a;\u91c7\u7528 \u5206\u7247\u9501 \u65b9\u6848&#xff0c;\u901a\u8fc7\u964d\u4f4e\u9501\u7c92\u5ea6\u83b7\u53d6\u7ebf\u6027\u6027\u80fd\u63d0\u5347\u3002<\/p>\n<\/li>\n<li>\n<p>\u8d85\u5927\u89c4\u6a21\/\u6beb\u79d2\u7ea7\u5ef6\u8fdf&#xff1a;\u679c\u65ad\u5207\u6362\u81f3 BigCache \u6216 FreeCache\u3002\u901a\u8fc7\u201c\u65e0\u6307\u9488 Map &#043; \u5b57\u8282\u6570\u7ec4\u5207\u7247\u201d\u7684\u6280\u672f\u7ec4\u5408&#xff0c;\u4ece\u6839\u672c\u4e0a\u89e3\u51b3 Go \u8bed\u8a00\u5728\u9ad8\u5e76\u53d1\u672c\u5730\u7f13\u5b58\u573a\u666f\u4e0b\u7684 GC \u74f6\u9888\u95ee\u9898\u3002<\/p>\n<\/li>\n","protected":false},"excerpt":{"rendered":"<p>\/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/#content_views .toc,\/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/#content_views.markdown_views &gt; p:empty:has(+ .toc),#content_views.markdown_views &gt; .toc + p:empty,\/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/#content<\/p>\n","protected":false},"author":2,"featured_media":116234,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[323],"topic":[],"class_list":["post-116235","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-323"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u9ad8\u5e76\u53d1\u573a\u666f\u4e0b\u7684\u672c\u5730\u7f13\u5b58\u8fdb\u5316\u8bba\uff1a\u4ece Go sync.Map \u5230 BigCache \u7684\u6027\u80fd\u8c03\u4f18\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/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.wsisp.com\/helps\/116235.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u9ad8\u5e76\u53d1\u573a\u666f\u4e0b\u7684\u672c\u5730\u7f13\u5b58\u8fdb\u5316\u8bba\uff1a\u4ece Go sync.Map \u5230 BigCache \u7684\u6027\u80fd\u8c03\u4f18\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/#content_views .toc,\/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/#content_views.markdown_views &gt; p:empty:has(+ .toc),#content_views.markdown_views &gt; .toc + p:empty,\/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/#content\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/116235.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-20T16:16:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020161632-6ad793e0deea3.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/116235.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/116235.html\",\"name\":\"\u9ad8\u5e76\u53d1\u573a\u666f\u4e0b\u7684\u672c\u5730\u7f13\u5b58\u8fdb\u5316\u8bba\uff1a\u4ece Go sync.Map \u5230 BigCache \u7684\u6027\u80fd\u8c03\u4f18\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-20T16:16:34+00:00\",\"dateModified\":\"2026-10-20T16:16:34+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/116235.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/116235.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/116235.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u9ad8\u5e76\u53d1\u573a\u666f\u4e0b\u7684\u672c\u5730\u7f13\u5b58\u8fdb\u5316\u8bba\uff1a\u4ece Go sync.Map \u5230 BigCache \u7684\u6027\u80fd\u8c03\u4f18\u5b9e\u8df5\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u9ad8\u5e76\u53d1\u573a\u666f\u4e0b\u7684\u672c\u5730\u7f13\u5b58\u8fdb\u5316\u8bba\uff1a\u4ece Go sync.Map \u5230 BigCache \u7684\u6027\u80fd\u8c03\u4f18\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","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.wsisp.com\/helps\/116235.html","og_locale":"zh_CN","og_type":"article","og_title":"\u9ad8\u5e76\u53d1\u573a\u666f\u4e0b\u7684\u672c\u5730\u7f13\u5b58\u8fdb\u5316\u8bba\uff1a\u4ece Go sync.Map \u5230 BigCache \u7684\u6027\u80fd\u8c03\u4f18\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/#content_views .toc,\/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/#content_views.markdown_views &gt; p:empty:has(+ .toc),#content_views.markdown_views &gt; .toc + p:empty,\/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/#content","og_url":"https:\/\/www.wsisp.com\/helps\/116235.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-20T16:16:34+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261020161632-6ad793e0deea3.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/116235.html","url":"https:\/\/www.wsisp.com\/helps\/116235.html","name":"\u9ad8\u5e76\u53d1\u573a\u666f\u4e0b\u7684\u672c\u5730\u7f13\u5b58\u8fdb\u5316\u8bba\uff1a\u4ece Go sync.Map \u5230 BigCache \u7684\u6027\u80fd\u8c03\u4f18\u5b9e\u8df5 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-20T16:16:34+00:00","dateModified":"2026-10-20T16:16:34+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/116235.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/116235.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/116235.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u9ad8\u5e76\u53d1\u573a\u666f\u4e0b\u7684\u672c\u5730\u7f13\u5b58\u8fdb\u5316\u8bba\uff1a\u4ece Go sync.Map \u5230 BigCache \u7684\u6027\u80fd\u8c03\u4f18\u5b9e\u8df5"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/116235","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=116235"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/116235\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/116234"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=116235"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=116235"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=116235"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=116235"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}