<p>Hi gophers!
Fast key:value go-cache lib
<a href="https://github.com/OrlovEvgeny/go-mcache" rel="nofollow">https://github.com/OrlovEvgeny/go-mcache</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's quite a bit off in his code..</p>
<ul>
<li>Global variables in his package; that'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're supposed to be able to run every test on its own. That's really not great. Aside from that, his tests also only cover very basic aspects. There's no testing at larger scale or under load of other read/writes. Naming this as a "fast key:value cache lib" 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 "safe map" 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>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传