Fast key:value go-cache lib

agolangf · · 92 次点击    
<p>Hi gophers! Fast key:value go-cache lib <a href="" rel="nofollow"></a> I will be glad to hear your comments, issues, pull request</p> <hr/>**评论:**<br/><br/>tgulacsi: <pre><p>Wow, what a gorgeously inefficient sync.Map! And starting a goroutine for each value inserted!?!</p> <p>Why not just a sync.Map and one goroutine with fixed eviction time (1m for example)?</p></pre>kapoof_euw: <pre><p>Not just that, there&#39;s quite a bit off in his code..</p> <ul> <li>Global variables in his package; that&#39;s just really bad style.</li> <li>Mutex error in the keyset: expireKey(..) vs. heartBeatGC(..).</li> <li>No way to shut down any of these services. They all start and run indefinitely.</li> <li>His tests rely on each other? You&#39;re supposed to be able to run every test on its own. That&#39;s really not great. Aside from that, his tests also only cover very basic aspects. There&#39;s no testing at larger scale or under load of other read/writes. Naming this as a &#34;fast key:value cache lib&#34; should definitely have tests under high load as that is the implied use case. Benchmarks should also definitely be included.</li> <li>Using a channel to serialize access to his &#34;safe map&#34; instead of a Mutex makes his code harder to understand <em>and</em> is inefficient at the same time. A RWMutex is more readable and would at least allow concurrent read from the cache.</li> </ul></pre>
92 次点击  
加入收藏 微博
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传