{"id":192,"date":"2017-08-20T11:31:39","date_gmt":"2017-08-20T03:31:39","guid":{"rendered":"https:\/\/www.myway5.com\/?p=192"},"modified":"2023-07-05T21:56:42","modified_gmt":"2023-07-05T13:56:42","slug":"leveldb-4-table-cache","status":"publish","type":"post","link":"https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/","title":{"rendered":"leveldb\u6e90\u4ee3\u7801\u9605\u8bfb\uff08\u56db\uff09- table cache\u7684\u5b9e\u73b0"},"content":{"rendered":"<h2>\u4e00\u3001\u524d\u8a00<\/h2>\n<p>\u7f13\u5b58\u5728\u6574\u4e2a\u8ba1\u7b97\u673a\u4f53\u7cfb\u4e2d\uff0c\u5360\u636e\u7740\u4e3e\u8db3\u8f7b\u91cd\u7684\u5730\u4f4d\uff0c\u5f80\u5f80\u88ab\u7528\u4e8e\u63d0\u5347\u8f6f\u4ef6\u7684\u8fd0\u884c\u901f\u5ea6\u3002\u5728\u8ba1\u7b97\u673a\u7cfb\u7edf\u4e2d\uff0c\u6700\u5178\u578b\u7684\u5f53\u5c5eCPU\u9ad8\u901f\u7f13\u5b58\u4e86\uff0cCPU\u9ad8\u901f\u7f13\u5b58\u662f\u4ecb\u4e8eCPU\u5bc4\u5b58\u5668\u548c\u5185\u5b58\u4e4b\u95f4\uff0cCPU\u5411\u5185\u5b58\u4e2d\u8bf7\u6c42\u6570\u636e\u65f6\uff0c\u4f1a\u5148\u68c0\u67e5CPU\u9ad8\u901f\u7f13\u5b58\u4e2d\u662f\u5426\u5b58\u5728\u6570\u636e\uff0c\u5982\u679c\u4e0d\u5b58\u5728\uff0c\u5219\u4f1a\u5c06\u5185\u5b58\u4e2d\u7684\u6570\u636e\u653e\u5165\u9ad8\u901f\u7f13\u5b58\u4e2d\uff0c\u518d\u5c06\u9ad8\u901f\u7f13\u5b58\u4e2d\u7684\u6570\u636e\u8bfb\u5165CPU\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\uff0c\u7f13\u5b58\u4e4b\u6240\u4ee5\u80fd\u591f\u5927\u5927\u7684\u63d0\u5347\u7cfb\u7edf\u901f\u5ea6\uff0c\u662f\u56e0\u4e3a\u7a0b\u5e8f\u5728\u8fd0\u884c\u7684\u65f6\u5019\u5bf9\u5185\u5b58\u7684\u8bbf\u95ee\u5177\u6709\u5c40\u90e8\u6027\u7684\u7279\u70b9\uff0c\u8fd9\u79cd\u5c40\u90e8\u6027\u6211\u7406\u89e3\u4e3a\u7a0b\u5e8f\u5728\u8fd0\u884c\u65f6\u5bf9\u67d0\u4e00\u5757\u7684\u5185\u5b58\u8bf7\u6c42\u4f1a\u975e\u5e38\u9891\u7e41\uff0c\u800c\u8fd9\u4e00\u5757\u5185\u5b58\u5728\u7b2c\u4e00\u6b21\u8bf7\u6c42\u4e4b\u540e\u5c31\u4f1a\u88ab\u7f13\u5b58\uff0c\u6240\u4ee5\u4f1a\u5927\u5927\u63d0\u5347\u4e4b\u540e\u7684\u6570\u636e\u8bfb\u53d6\u901f\u5ea6\u3002<em>\u6240\u4ee5\uff0c\u7f13\u5b58\u8bbe\u8ba1\u7684\u662f\u5426\u5408\u7406\u6709\u6548\uff0c\u5728\u4e8e\u7f13\u5b58\u7684\u547d\u4e2d\u7387\u9ad8\u4e0d\u9ad8\u3002<\/em><\/p>\n<p>\u5728leveldb\u4e2d\uff0c\u4e3a\u4e86\u63d0\u5347\u5bf9\u6570\u636e\u7684\u68c0\u7d22\u901f\u5ea6\uff0c\u4e5f\u8bbe\u8ba1\u4e86\u7f13\u5b58\uff0c\u5bf9\u5e94\u7684\u4ee3\u7801\u5728db\/table_cache.h\u548cdb\/table_cache.cc\u4e2d\uff0c\u8fd9\u4e2atable cache\u7684\u5b9e\u73b0\u4e3b\u8981\u501f\u52a9\u4e8eCache\u7c7b\uff0c\u5173\u4e8eCache\u7c7b\uff0c\u662f\u53ef\u4ee5\u7528\u6237\u81ea\u5b9a\u4e49\u5b9e\u73b0\u7684\uff0c\u4f46leveldb\u4e5f\u6709\u4e00\u4e2a\u5185\u7f6e\u7684Cache\u7684\u5b9e\u73b0\uff0c\u6587\u4ef6\u662futil\/cache.cc\u3002\u4e3b\u8981\u662fLRU\uff08\u6700\u8fd1\u6700\u5c11\u4f7f\u7528\uff09\u7b97\u6cd5\uff0c\u539f\u7406\u662f\u201c\u5982\u679c\u4e00\u4e2a\u6570\u636e\u6700\u8fd1\u88ab\u4f7f\u7528\uff0c\u90a3\u4e48\u5c06\u6765\u88ab\u4f7f\u7528\u7684\u6982\u7387\u540c\u6837\u4e5f\u5f88\u5927\u201d\u3002\u540c\u6837\u4e5f\u5b9e\u73b0\u4e86\u4e00\u4e2aHashTable\uff0cleveldb\u4e2d\u63d0\u4f9b\u7684\u6570\u636e\u663e\u793a\u5728g++ 4.4.3\u4e0b\u6bd4built-in\u7684\u54c8\u5e0c\u8868\u6027\u80fd\u7a0d\u9ad8\uff0c\u5927\u69825%\u5de6\u53f3\u3002<\/p>\n<h2>\u4e8c\u3001\u6982\u89c8<\/h2>\n<h3>2.1 hash table\u6570\u636e\u7ed3\u6784<\/h3>\n<p>\u54c8\u5e0c\u8868\u662f\u4e00\u4e2a\u5f88\u5e38\u89c1\u7684\u7ed3\u6784\u4e86\uff0c\u5b58\u50a8\u7684\u662fkey-value\u7ed3\u6784\uff0c\u4e00\u4e2akey-value\u5bf9\u5e38\u88ab\u79f0\u4f5centry\uff0c\u5b83\u6700\u5927\u7684\u7279\u70b9\u662f\u67e5\u627e\u5feb\u3002\u5728\u7f51\u4e0a\u627e\u4e86\u4e00\u5f20hash table\u7684\u56fe<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.myway5.com\/wp-content\/uploads\/2017\/07\/450px-Hash_table_5_0_1_1_1_1_1_LL.svg_.png\" alt=\"hash table\" \/><\/p>\n<p>\u9996\u5148\u5b83\u662f\u4e00\u4e2a\u957f\u4e3alen\u7684\u6570\u7ec4\uff0c\u6bcf\u4e2a\u6570\u7ec4\u4e2d\u7684\u5143\u7d20\u90fd\u662f\u4e00\u4e2a\u94fe\u8868\u3002\u5982\u56fe\u6240\u793a\uff0cjohn Smith\u548cSandra Dee\u90fd\u88abhash\u5230152\u8fd9\u4e2a\u5730\u65b9\uff0c\u6240\u4ee5\u5728152\u8fd9\u4e2a\u5730\u65b9\u4f7f\u7528\u94fe\u8868\u6765\u5b58\u50a8\u8fd9\u4e24\u4e2aentry.\u67e5\u627e\u7684\u65f6\u5019Sandra Dee\u7684\u65f6\u5019\uff0c\u5148\u627e\u5230152\u8fd9\u4e2a\u5730\u65b9\uff0c\u5728\u904d\u5386\u94fe\u8868\uff0c\u76f4\u5230\u627e\u5230key\u662fSandra\u7684entry\u3002<\/p>\n<h3>2.2 LRU\u7b97\u6cd5<\/h3>\n<p>\u5728leveldb\u4e2d,LRU\u7b97\u6cd5\u7684\u5b9e\u73b0\u662f\u4f7f\u7528\u4e24\u4e2a\u53cc\u5411\u73af\u5f62\u94fe\u8868\uff0c\u4e00\u4e2a\u94fe\u8868(in-use)\u5b58\u50a8\u5f53\u524d\u6b63\u5728\u4f7f\u7528\u7684\u6570\u636e\uff0c\u53e6\u4e00\u4e2a\u94fe\u8868(lru)\u6309\u7167\u8bbf\u95ee\u65f6\u95f4\u5148\u540e\u987a\u5e8f\u5b58\u50a8\u7f13\u5b58\u6570\u636e\uff0c\u6bcf\u4e2a\u6570\u636e\u90fd\u53ef\u4ee5\u5728in-use\u548clru\u4e4b\u95f4\u5207\u6362\u3002\u5f53\u6211\u4eec\u9700\u8981\u4f7f\u7528LRU\u7b97\u6cd5\u6765\u6dd8\u6c70\u6570\u636e\u65f6\uff0c\u53ea\u9700\u8981\u5728lru\u4e0a\u6dd8\u6c70\u6392\u5e8f\u9760\u540e\u7684\u6570\u636e\u5373\u53ef\u3002<\/p>\n<h3>2.3 \u5206\u7247LRU\u7f13\u5b58<\/h3>\n<p>\u5206\u7247LRU\u7f13\u5b58\u5f88\u7b80\u5355\uff0c\u5176\u5b9e\u5c31\u662f\u540c\u65f6\u521b\u5efa\u591a\u4e2aLRU\u7f13\u5b58\u5bf9\u8c61\uff0c\u7136\u540e\u4f7f\u7528hash\u5c06\u7279\u5b9a\u7684\u7f13\u5b58\u6570\u636e\u653e\u7f6e\u5230\u76f8\u5e94\u7684LRU\u7f13\u5b58\u5bf9\u8c61\u4e2d\u3002\u8fd9\u4e2a\u65b9\u5f0f\u53ef\u4ee5\u907f\u514d\u4e00\u4e2aLRU\u7f13\u5b58\u4e2d\u5b58\u50a8\u8fc7\u591a\u7684\u6570\u636e\u3002<\/p>\n<h2>\u4e09\u3001\u8be6\u7ec6\u5206\u6790<\/h2>\n<h3>3.1 Hash Table<\/h3>\n<p>leveldb\u4e2d\u5b9e\u73b0\u4e86HashTable\uff0c\u4f7f\u7528\u7684\u662f\u6700\u7ecf\u5178\u7684\u6570\u7ec4+\u94fe\u8868\u7684\u5b9e\u73b0\u3002\u901a\u8fc7hash\u503c\u5b9a\u4f4d\u5230\u6570\u7ec4\u4e2d\u7684\u67d0\u4e00\u5904\uff0c\u7136\u540e\u5728\u8fd9\u4e00\u5904\u7684\u94fe\u8868\u4e0a\u904d\u5386\u67e5\u627e\u3002<\/p>\n<p>HashTable\u7684\u957f\u5ea6\u662f\u54c8\u5e0c\u7b97\u6cd5\u6548\u7387\u7684\u6700\u5927\u5f71\u54cd\u56e0\u7d20\uff0c\u5982\u679c\u5b58\u5728\u8f83\u591a\u7684hash\u51b2\u7a81\uff0c\u5219\u5728\u94fe\u8868\u4e0a\u904d\u5386\u67e5\u627e\u7684\u65f6\u95f4\u82b1\u8d39\u4f1a\u5f88\u957f\u3002\u6240\u4ee5\u8fd9\u4e2a\u957f\u5ea6\u7684\u9009\u62e9\u662f\u5f88\u91cd\u8981\u7684\uff0c\u6bd4\u5982\u5728Java\u4e2d\u7684HashMap,\u5b9e\u73b0\u4e2d\u6709\u4e00\u4e2a\u8d1f\u8f7d\u56e0\u5b500.7\uff0c\u5982\u679c\u6570\u7ec4\u4e0a\u5df2\u7ecf\u6709\u503c\u7684\u6570\u91cf\u8d85\u8fc7\u603b\u957f\u5ea6\u76840.7\u5c31\u4f1a\u5bf9\u6574\u4e2a\u54c8\u5e0c\u8868resize\u3002\u5728leveldb\u4e2d\uff0c\u8fd9\u4e2aresize\u7684\u9608\u503c\u662f\u5f53\u524d\u6240\u6709Insert\u8fdb\u6765\u7684\u5143\u7d20\u4e2a\u6570\u8d85\u8fc7\u4e86\u6570\u7ec4\u7684\u957f\u5ea6length\uff0c\u5c31\u4f1a\u8fdb\u884cresize\u3002\u8fd9\u91cc\u7b80\u5355\u7684\u5206\u6790\u4e00\u4e0b\u6700\u91cd\u8981\u7684\u67e5\u627e\u548cresize\u8fc7\u7a0b\u3002<\/p>\n<ul>\n<li>\u54c8\u5e0c\u8868\u67e5\u627e\u8fc7\u7a0b<\/li>\n<\/ul>\n<pre><code class=\"line-numbers\">  \/\/ Return a pointer to slot that points to a cache entry that\n  \/\/ matches key\/hash.  If there is no such cache entry, return a\n  \/\/ pointer to the trailing slot in the corresponding linked list.\n  LRUHandle** FindPointer(const Slice&amp; key, uint32_t hash) {\n    LRUHandle** ptr = &amp;list_[hash &amp; (length_ - 1)];     \/\/\u8fd9\u91cchash &amp; (length_ - 1)\u4f1a\u5b9a\u4f4d\u5230\u5c0f\u4e8elength\u7684\u4f4d\u7f6e,ptr\u5c31\u662fhash\u5230\u7684\u4f4d\u7f6e\n    while (*ptr != NULL &amp;&amp;\n           ((*ptr)-&gt;hash != hash || key != (*ptr)-&gt;key())) {\n           \/\/hash\u5230\u7279\u5b9a\u4f4d\u7f6e\u540e\uff0c\u5982\u679c\u5f53\u524d\u4f4d\u7f6e\u7684hash\u548c\u5f53\u524dhash\u4e0d\u4e00\u6837\uff0c\u6216\u8005key\u4e0d\u4e00\u6837\uff0c\u5e76\u4e14\u6307\u9488\u4e5f\u4e0d\u4e3a\u7a7a\uff0c\u5219\u7ee7\u7eed\u5411\u4e0b\u627e\uff0c\u76f4\u5230\u627e\u5230\n      ptr = &amp;(*ptr)-&gt;next_hash;\n    }\n    return ptr;\n  }\n<\/code><\/pre>\n<ul>\n<li>\u54c8\u5e0c\u8868resize\u7684\u8fc7\u7a0b<\/li>\n<\/ul>\n<pre><code class=\"line-numbers\">   void Resize() {\n    uint32_t new_length = 4;        \/\/\u54c8\u5e0c\u8868\u7684\u957f\u5ea6\u4ece4\u5f00\u59cb\uff0c\u9010\u500d\u589e\u957f\n    while (new_length &lt; elems_) {\n      new_length *= 2;\n    }\n    LRUHandle** new_list = new LRUHandle*[new_length];\n    memset(new_list, 0, sizeof(new_list[0]) * new_length);      \/\/\u7533\u8bf7\u65b0\u7684\u54c8\u5e0c\u8868\u7684\u6240\u9700\u7684\u7a7a\u95f4\n    uint32_t count = 0;\n    for (uint32_t i = 0; i &lt; length_; i++) {    \/\/\u5c06\u65e7\u7684\u54c8\u5e0c\u8868\u7684\u6570\u636e\u91cd\u65b0\u8ba1\u7b97\u590d\u5236\u5230\u65b0\u7684\u54c8\u5e0c\u8868\u4e2d\n      LRUHandle* h = list_[i];\n      while (h != NULL) {\n        LRUHandle* next = h-&gt;next_hash;\n        uint32_t hash = h-&gt;hash;\n        LRUHandle** ptr = &amp;new_list[hash &amp; (new_length - 1)];\n        h-&gt;next_hash = *ptr;\n        *ptr = h;\n        h = next;\n        count++;\n      }\n    }\n    assert(elems_ == count);\n    delete[] list_; \/\/\u5220\u9664\u65e7\u7684\u54c8\u5e0c\u8868\n    list_ = new_list;\n    length_ = new_length;\n  }\n};\n<\/code><\/pre>\n<h3>3.2 LRUCache\u7684\u5b9e\u73b0<\/h3>\n<p>\u8fd9\u91cc\u7684LRUCache\u7684\u79c1\u6709\u6210\u5458\u53d8\u91cf\u5305\u62ec\u4ee5\u4e0b\u51e0\u4e2a<\/p>\n<pre><code class=\"line-numbers\">  \/\/ Initialized before use.\n  size_t capacity_;         \/\/LRUCache\u7684\u5927\u5c0f\u3002\n\n  \/\/ mutex_ protects the following state.\n  mutable port::Mutex mutex_;       \/\/\u4e92\u65a5\u53d8\u91cf\uff0c\u7528\u6765\u540c\u6b65\u8bbf\u95ee\n  size_t usage_;                    \/\/LRUCache\u5df2\u7ecf\u4f7f\u7528\u7684\u5927\u5c0f\n\n  \/\/ Dummy head of LRU list.\n  \/\/ lru.prev is newest entry, lru.next is oldest entry.\n  \/\/ Entries have refs==1 and in_cache==true.\n  LRUHandle lru_;                   \/\/LRU\u94fe\u8868\u7684\u5934\uff0clru.prev\u4ee3\u8868\u65b0\u7684\u8282\u70b9\uff0clru.next\u4ee3\u8868\u65e7\u7684\u8282\u70b9\uff0c\u8282\u70b9\u7684refs == 1,in_cache == true\n\n  \/\/ Dummy head of in-use list.\n  \/\/ Entries are in use by clients, and have refs &gt;= 2 and in_cache==true.\n  LRUHandle in_use_;                \/\/\u6b63\u5728\u4f7f\u7528\u7684\u8282\u70b9\u94fe\u8868\u7684\u5934\uff0crefs &gt;= 2\uff0cin_cache == true\n\n  HandleTable table_;               \/\/\u54c8\u5e0c\u8868\uff0c\u7528\u6765\u5728\u7f13\u5b58\u4e2d\u5b9e\u73b0\u5feb\u901f\u67e5\u627e\n<\/code><\/pre>\n<p>LRU\u7684\u6784\u9020\u51fd\u6570\uff0c\u76f4\u63a5\u6784\u9020\u51fa\u7a7a\u7684\u73af\u5f62\u94fe\u8868<\/p>\n<pre><code class=\"line-numbers\">LRUCache::LRUCache()\n    : usage_(0) {\n  \/\/ Make empty circular linked lists.\n  lru_.next = &amp;lru_;\n  lru_.prev = &amp;lru_;\n  in_use_.next = &amp;in_use_;\n  in_use_.prev = &amp;in_use_;\n}\n<\/code><\/pre>\n<p>LRU\u4e2d\u8282\u70b9\u7684\u5f15\u7528\u548c\u89e3\u5f15\u7528<\/p>\n<pre><code class=\"line-numbers\">\/\/\u589e\u52a0\u5f15\u7528\u65f6\uff0c\u5982\u679c\u5728\u7f13\u5b58\u4e2d\uff0c\u5219\u79fb\u52a8\u5230in_use\u4e2d\nvoid LRUCache::Ref(LRUHandle* e) {\n  if (e-&gt;refs == 1 &amp;&amp; e-&gt;in_cache) {  \/\/ If on lru_ list, move to in_use_ list.\n    LRU_Remove(e);\n    LRU_Append(&amp;in_use_, e);\n  }\n  e-&gt;refs++;\n}\n\n\/\/\u89e3\u5f15\u7528\u65f6\u4f1a\u51fa\u73b0\u4e24\u79cd\u60c5\u51b5\u30021.\u8282\u70b9\u4e0d\u518d\u9700\u8981\uff0c\u4f7f\u7528deleter\u6765\u5220\u9664\u8282\u70b9 2.\u4e0d\u518d\u88ab\u4f7f\u7528\uff0c\u79fb\u52a8\u5230\u7f13\u5b58\nvoid LRUCache::Unref(LRUHandle* e) {\n  assert(e-&gt;refs &gt; 0);\n  e-&gt;refs--;\n  if (e-&gt;refs == 0) { \/\/ Deallocate.\n    assert(!e-&gt;in_cache);\n    (*e-&gt;deleter)(e-&gt;key(), e-&gt;value);\n    free(e);\n  } else if (e-&gt;in_cache &amp;&amp; e-&gt;refs == 1) {  \/\/ No longer in use; move to lru_ list.\n    LRU_Remove(e);\n    LRU_Append(&amp;lru_, e);\n  }\n}\n<\/code><\/pre>\n<p>\u7f13\u5b58\u7684\u63d2\u5165<\/p>\n<pre><code class=\"line-numbers\">Cache::Handle* LRUCache::Insert(\n    const Slice&amp; key, uint32_t hash, void* value, size_t charge,\n    void (*deleter)(const Slice&amp; key, void* value)) {\n  MutexLock l(&amp;mutex_);\n\n  LRUHandle* e = reinterpret_cast&lt;LRUHandle*&gt;(\n      malloc(sizeof(LRUHandle)-1 + key.size()));    \/\/\u8fd9\u4e2a\u5730\u65b9\u7533\u8bf7\u5185\u5b58\u9700\u8981\u6ce8\u610f\uff0c\u5728LRUHandle\u4e2d\uff0ckey_data\u53ea\u67091\u4e2a\u5b57\u8282\uff0c\u5176\u5b9e\u662f\u6574\u4e2akey\u7684\u5f00\u5934\u4e00\u4e2a\u5b57\u8282\uff0c\u6240\u4ee5\u7533\u8bf7\u7684\u7a7a\u95f4\u5b9e\u9645\u4e0a\u662f\u5305\u542b\u6574\u4e2akey\u7684\n  e-&gt;value = value;\n  e-&gt;deleter = deleter;\n  e-&gt;charge = charge;\n  e-&gt;key_length = key.size();\n  e-&gt;hash = hash;\n  e-&gt;in_cache = false;\n  e-&gt;refs = 1;  \/\/ for the returned handle.\n  memcpy(e-&gt;key_data, key.data(), key.size());\n\n  if (capacity_ &gt; 0) {      \/\/\u5982\u679ccapacity\u5927\u4e8e0\uff0c\u4e5f\u5c31\u662f\u9700\u8981\u8fdb\u884c\u7f13\u5b58\n    e-&gt;refs++;  \/\/ for the cache's reference.\n    e-&gt;in_cache = true;\n    LRU_Append(&amp;in_use_, e);\n    usage_ += charge;\n    FinishErase(table_.Insert(e));\n  } \/\/ else don't cache.  (Tests use capacity_==0 to turn off caching.)\n\n    \/\/\u5f53\u4f7f\u7528\u7684\u5185\u5b58\u5927\u4e8e\u5bb9\u91cf\u65f6\uff0c\u5219\u8981\u79fb\u9664\u65e7\u7684\u7f13\u5b58\uff0c\u76f4\u5230\u7f13\u5b58\u5c0f\u4e8e\u6307\u5b9a\u7684\u5bb9\u91cf\n  while (usage_ &gt; capacity_ &amp;&amp; lru_.next != &amp;lru_) {\n    LRUHandle* old = lru_.next;\n    assert(old-&gt;refs == 1);\n    bool erased = FinishErase(table_.Remove(old-&gt;key(), old-&gt;hash));\n    if (!erased) {  \/\/ to avoid unused variable when compiled NDEBUG\n      assert(erased);\n    }\n  }\n\n  return reinterpret_cast&lt;Cache::Handle*&gt;(e);\n}\n<\/code><\/pre>\n<p>\u7f13\u5b58\u7684\u67e5\u627e<\/p>\n<pre><code class=\"line-numbers\">Cache::Handle* LRUCache::Lookup(const Slice&amp; key, uint32_t hash) {\n  MutexLock l(&amp;mutex_);\n  LRUHandle* e = table_.Lookup(key, hash);      \/\/\u76f4\u63a5\u501f\u7528\u54c8\u5e0c\u8868\u5b8c\u6210\u7f13\u5b58\u7684\u5feb\u901f\u67e5\u627e\n  if (e != NULL) {\n    Ref(e);\n  }\n  return reinterpret_cast&lt;Cache::Handle*&gt;(e);\n}\n<\/code><\/pre>\n<h3>3.3 \u5206\u7247\u7f13\u5b58\u7684\u5b9e\u73b0(ShardedLRUCache)<\/h3>\n<p>\u5206\u7247\u7f13\u5b58\u7684\u5b9e\u73b0\u5176\u5b9e\u5c31\u662f\u501f\u52a9\u4e0a\u9762\u7684LRUCaChe\uff0c\u53ea\u4e0d\u8fc7\u540c\u65f6\u62e5\u6709\u591a\u4e2aLRUCache\uff0c\u7136\u540e\u7279\u5b9a\u7684\u7f13\u5b58\u6570\u636e\u4f1a\u88ab\u7f13\u5b58\u5230\u76f8\u5e94\u7684LRUCache\u4e2d\u3002<\/p>\n<pre><code class=\"line-numbers\">static const int kNumShardBits = 4;                     \/\/\u53ef\u4ee5\u7406\u89e3\u4e3a\u7f13\u5b58\u7247\u6570\u91cf\u7684\u5bb9\u91cf\u56e0\u5b50(\u8fd9\u91cc\u662f4\u4e2abits\uff0c\u6240\u4ee5\u5171\u670916\u4e2a\u7f13\u5b58\u7247\uff09\nstatic const int kNumShards = 1 &lt;&lt; kNumShardBits;       \/\/\u4e00\u5171\u6709\u591a\u5c11\u4e2a\u7f13\u5b58\u7247\n\n\/\/\u901a\u8fc7Shard\u51fd\u6570\u53ef\u4ee5\u5c06\u4efb\u610f\u4e00\u4e2ahash\u5206\u914d\u523016\u4e2a\u7f13\u5b58\u7247\u4e2d\u7684\u4efb\u610f\u4e00\u4e2a)\nstatic uint32_t Shard(uint32_t hash) {\n    return hash &gt;&gt; (32 - kNumShardBits);\n}\n<\/code><\/pre>\n<p>\u6240\u6709\u7684\u7f13\u5b58\u5b58\u50a8\u548c\u8bfb\u53d6\u90fd\u4f1a\u901a\u8fc7\u4e0a\u9762\u7684Shard\u51fd\u6570\u6765\u627e\u5230\u7279\u5b9a\u7684\u7f13\u5b58\u7247\uff0c\u4ece\u800c\u5b9e\u73b0\u4e86\u5206\u7247\u7f13\u5b58\u3002<\/p>\n<h2>\u4e94\u3001\u603b\u7ed3<\/h2>\n<p>\u5728\u8fd9\u4e2a\u90e8\u5206\uff0c400\u884c\u5de6\u53f3\u7684\u4ee3\u7801\u5c31\u5b9e\u73b0\u4e86\u54c8\u5e0c\u8868\uff0cLRU\u7f13\u5b58\uff0c\u5206\u7247LRU\u7f13\u5b58\u3002\u4e86\u89e3\u5230LRU\u7f13\u5b58\u7684\u5177\u4f53\u5b9e\u73b0\u65b9\u5f0f\uff0c\u7279\u522b\u662fLRU\u4e2dRef\u548cUnRef\u7684\u5b9e\u73b0\u975e\u5e38\u7cbe\u70bc\uff0c\u5f88\u597d\u7684\u89e3\u51b3\u4e86\u4e00\u4e2a\u6570\u636e\u5728LRU\u7f13\u5b58\u4e2d\u88ab\u5f15\u7528\u65f6\u8131\u79bb\u7f13\u5b58\uff0c\u4e0d\u4f7f\u7528\u65f6\u8fdb\u5165LRU\u7f13\u5b58\u7684\u529f\u80fd\u3002\u540c\u65f6\u5c06LRU\u7f13\u5b58\u7b80\u5355\u7684\u5c01\u88c5\uff0c\u5c31\u53ef\u4ee5\u5b9e\u73b0\u5206\u7247LRU\u7f13\u5b58\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u524d\u8a00 \u7f13\u5b58\u5728\u6574\u4e2a\u8ba1\u7b97\u673a\u4f53\u7cfb\u4e2d\uff0c\u5360\u636e\u7740\u4e3e\u8db3\u8f7b\u91cd\u7684\u5730\u4f4d\uff0c\u5f80\u5f80\u88ab\u7528\u4e8e\u63d0\u5347\u8f6f\u4ef6\u7684\u8fd0\u884c\u901f\u5ea6\u3002\u5728\u8ba1\u7b97\u673a\u7cfb\u7edf\u4e2d\uff0c\u6700\u5178\u578b\u7684 &hellip; <a href=\"https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">leveldb\u6e90\u4ee3\u7801\u9605\u8bfb\uff08\u56db\uff09- table cache\u7684\u5b9e\u73b0<\/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":[23],"tags":[32,34,24,33,35],"class_list":["post-192","post","type-post","status-publish","format-standard","hentry","category-leveldb","tag-cache","tag-hash","tag-leveldb","tag-lru","tag-shardedlrucache"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>leveldb\u6e90\u4ee3\u7801\u9605\u8bfb\uff08\u56db\uff09- table cache\u7684\u5b9e\u73b0 - \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\/08\/20\/leveldb-4-table-cache\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"leveldb\u6e90\u4ee3\u7801\u9605\u8bfb\uff08\u56db\uff09- table cache\u7684\u5b9e\u73b0 - \u4e00\u53ea\u5b89\u9759\u7684\u732b\" \/>\n<meta property=\"og:description\" content=\"\u4e00\u3001\u524d\u8a00 \u7f13\u5b58\u5728\u6574\u4e2a\u8ba1\u7b97\u673a\u4f53\u7cfb\u4e2d\uff0c\u5360\u636e\u7740\u4e3e\u8db3\u8f7b\u91cd\u7684\u5730\u4f4d\uff0c\u5f80\u5f80\u88ab\u7528\u4e8e\u63d0\u5347\u8f6f\u4ef6\u7684\u8fd0\u884c\u901f\u5ea6\u3002\u5728\u8ba1\u7b97\u673a\u7cfb\u7edf\u4e2d\uff0c\u6700\u5178\u578b\u7684 &hellip; \u7ee7\u7eed\u9605\u8bfbleveldb\u6e90\u4ee3\u7801\u9605\u8bfb\uff08\u56db\uff09- table cache\u7684\u5b9e\u73b0\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/\" \/>\n<meta property=\"og:site_name\" content=\"\u4e00\u53ea\u5b89\u9759\u7684\u732b\" \/>\n<meta property=\"article:published_time\" content=\"2017-08-20T03:31:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-05T13:56:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.myway5.com\/wp-content\/uploads\/2017\/07\/450px-Hash_table_5_0_1_1_1_1_1_LL.svg_.png\" \/>\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=\"3 \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\/08\/20\/leveldb-4-table-cache\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/\"},\"author\":{\"name\":\"jiangpengfei\",\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"headline\":\"leveldb\u6e90\u4ee3\u7801\u9605\u8bfb\uff08\u56db\uff09- table cache\u7684\u5b9e\u73b0\",\"datePublished\":\"2017-08-20T03:31:39+00:00\",\"dateModified\":\"2023-07-05T13:56:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/\"},\"wordCount\":103,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685\"},\"image\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.myway5.com\/wp-content\/uploads\/2017\/07\/450px-Hash_table_5_0_1_1_1_1_1_LL.svg_.png\",\"keywords\":[\"cache\",\"hash\",\"leveldb\",\"lru\",\"shardedLRUCache\"],\"articleSection\":[\"levelDB\u6e90\u7801\u9605\u8bfb\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/\",\"url\":\"https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/\",\"name\":\"leveldb\u6e90\u4ee3\u7801\u9605\u8bfb\uff08\u56db\uff09- table cache\u7684\u5b9e\u73b0 - \u4e00\u53ea\u5b89\u9759\u7684\u732b\",\"isPartOf\":{\"@id\":\"https:\/\/www.myway5.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.myway5.com\/wp-content\/uploads\/2017\/07\/450px-Hash_table_5_0_1_1_1_1_1_LL.svg_.png\",\"datePublished\":\"2017-08-20T03:31:39+00:00\",\"dateModified\":\"2023-07-05T13:56:42+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/#primaryimage\",\"url\":\"https:\/\/www.myway5.com\/wp-content\/uploads\/2017\/07\/450px-Hash_table_5_0_1_1_1_1_1_LL.svg_.png\",\"contentUrl\":\"https:\/\/www.myway5.com\/wp-content\/uploads\/2017\/07\/450px-Hash_table_5_0_1_1_1_1_1_LL.svg_.png\",\"width\":450,\"height\":310},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.myway5.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"leveldb\u6e90\u4ee3\u7801\u9605\u8bfb\uff08\u56db\uff09- table cache\u7684\u5b9e\u73b0\"}]},{\"@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":"leveldb\u6e90\u4ee3\u7801\u9605\u8bfb\uff08\u56db\uff09- table cache\u7684\u5b9e\u73b0 - \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\/08\/20\/leveldb-4-table-cache\/","og_locale":"zh_CN","og_type":"article","og_title":"leveldb\u6e90\u4ee3\u7801\u9605\u8bfb\uff08\u56db\uff09- table cache\u7684\u5b9e\u73b0 - \u4e00\u53ea\u5b89\u9759\u7684\u732b","og_description":"\u4e00\u3001\u524d\u8a00 \u7f13\u5b58\u5728\u6574\u4e2a\u8ba1\u7b97\u673a\u4f53\u7cfb\u4e2d\uff0c\u5360\u636e\u7740\u4e3e\u8db3\u8f7b\u91cd\u7684\u5730\u4f4d\uff0c\u5f80\u5f80\u88ab\u7528\u4e8e\u63d0\u5347\u8f6f\u4ef6\u7684\u8fd0\u884c\u901f\u5ea6\u3002\u5728\u8ba1\u7b97\u673a\u7cfb\u7edf\u4e2d\uff0c\u6700\u5178\u578b\u7684 &hellip; \u7ee7\u7eed\u9605\u8bfbleveldb\u6e90\u4ee3\u7801\u9605\u8bfb\uff08\u56db\uff09- table cache\u7684\u5b9e\u73b0","og_url":"https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/","og_site_name":"\u4e00\u53ea\u5b89\u9759\u7684\u732b","article_published_time":"2017-08-20T03:31:39+00:00","article_modified_time":"2023-07-05T13:56:42+00:00","og_image":[{"url":"https:\/\/www.myway5.com\/wp-content\/uploads\/2017\/07\/450px-Hash_table_5_0_1_1_1_1_1_LL.svg_.png","type":"","width":"","height":""}],"author":"jiangpengfei","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"jiangpengfei","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/#article","isPartOf":{"@id":"https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/"},"author":{"name":"jiangpengfei","@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"headline":"leveldb\u6e90\u4ee3\u7801\u9605\u8bfb\uff08\u56db\uff09- table cache\u7684\u5b9e\u73b0","datePublished":"2017-08-20T03:31:39+00:00","dateModified":"2023-07-05T13:56:42+00:00","mainEntityOfPage":{"@id":"https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/"},"wordCount":103,"commentCount":1,"publisher":{"@id":"https:\/\/www.myway5.com\/#\/schema\/person\/b19267e8b106343431e163ec96950685"},"image":{"@id":"https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/#primaryimage"},"thumbnailUrl":"https:\/\/www.myway5.com\/wp-content\/uploads\/2017\/07\/450px-Hash_table_5_0_1_1_1_1_1_LL.svg_.png","keywords":["cache","hash","leveldb","lru","shardedLRUCache"],"articleSection":["levelDB\u6e90\u7801\u9605\u8bfb"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/","url":"https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/","name":"leveldb\u6e90\u4ee3\u7801\u9605\u8bfb\uff08\u56db\uff09- table cache\u7684\u5b9e\u73b0 - \u4e00\u53ea\u5b89\u9759\u7684\u732b","isPartOf":{"@id":"https:\/\/www.myway5.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/#primaryimage"},"image":{"@id":"https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/#primaryimage"},"thumbnailUrl":"https:\/\/www.myway5.com\/wp-content\/uploads\/2017\/07\/450px-Hash_table_5_0_1_1_1_1_1_LL.svg_.png","datePublished":"2017-08-20T03:31:39+00:00","dateModified":"2023-07-05T13:56:42+00:00","breadcrumb":{"@id":"https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/"]}]},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/#primaryimage","url":"https:\/\/www.myway5.com\/wp-content\/uploads\/2017\/07\/450px-Hash_table_5_0_1_1_1_1_1_LL.svg_.png","contentUrl":"https:\/\/www.myway5.com\/wp-content\/uploads\/2017\/07\/450px-Hash_table_5_0_1_1_1_1_1_LL.svg_.png","width":450,"height":310},{"@type":"BreadcrumbList","@id":"https:\/\/www.myway5.com\/index.php\/2017\/08\/20\/leveldb-4-table-cache\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.myway5.com\/"},{"@type":"ListItem","position":2,"name":"leveldb\u6e90\u4ee3\u7801\u9605\u8bfb\uff08\u56db\uff09- table cache\u7684\u5b9e\u73b0"}]},{"@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":8848,"_links":{"self":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/192","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=192"}],"version-history":[{"count":2,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/192\/revisions"}],"predecessor-version":[{"id":1603,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/posts\/192\/revisions\/1603"}],"wp:attachment":[{"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/media?parent=192"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/categories?post=192"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.myway5.com\/index.php\/wp-json\/wp\/v2\/tags?post=192"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}