Ai
1 Star 0 Fork 0

micro-tools/wf

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
gcache_adapter_memory_expire_times.go 895 Bytes
一键复制 编辑 原始数据 按行查看 历史
545403892 提交于 2023-09-27 22:16 +08:00 . 升级go-ole
package gcache
import (
"sync"
)
type adapterMemoryExpireTimes struct {
mu sync.RWMutex // expireTimeMu ensures the concurrent safety of expireTimes map.
expireTimes map[interface{}]int64 // expireTimes is the expiring key to its timestamp mapping, which is used for quick indexing and deleting.
}
func newAdapterMemoryExpireTimes() *adapterMemoryExpireTimes {
return &adapterMemoryExpireTimes{
expireTimes: make(map[interface{}]int64),
}
}
func (d *adapterMemoryExpireTimes) Get(key interface{}) (value int64) {
d.mu.RLock()
value = d.expireTimes[key]
d.mu.RUnlock()
return
}
func (d *adapterMemoryExpireTimes) Set(key interface{}, value int64) {
d.mu.Lock()
d.expireTimes[key] = value
d.mu.Unlock()
}
func (d *adapterMemoryExpireTimes) Delete(key interface{}) {
d.mu.Lock()
delete(d.expireTimes, key)
d.mu.Unlock()
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/micro-tools/wf.git
git@gitee.com:micro-tools/wf.git
micro-tools
wf
wf
v1.0.2

搜索帮助