We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://github.com/hunterhug/gocache/blob/master/README_ZH.md
该库使用了红黑树和最小堆数据结构。利用最小堆堆顶是最老的值,从而快速清洗过期值。可以认为是一个有过期时间的 K-V 本地内存数据库。
原理很简单:
一个 treeMap 用来保存 K-V,一个最小堆的完全树用来清洗过期 key。 官方的 map 不会缩容,treemap 的话不会占用多余空间。 开了个定时器惰性删除过期key,由于定时器每秒最多清除30个过期,可能不够实时,所以当客户端主动拿值时会进行实时删除key,参考的redis。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
https://github.com/hunterhug/gocache/blob/master/README_ZH.md
该库使用了红黑树和最小堆数据结构。利用最小堆堆顶是最老的值,从而快速清洗过期值。可以认为是一个有过期时间的 K-V 本地内存数据库。
原理很简单:
一个 treeMap 用来保存 K-V,一个最小堆的完全树用来清洗过期 key。
官方的 map 不会缩容,treemap 的话不会占用多余空间。
开了个定时器惰性删除过期key,由于定时器每秒最多清除30个过期,可能不够实时,所以当客户端主动拿值时会进行实时删除key,参考的redis。
The text was updated successfully, but these errors were encountered: