123456789101112131415161718192021222324252627282930313233343536373839 |
- package cache
- import (
- "sync"
- )
- var (
- memCache sync.Map
- )
- func Load(key interface{}) (value interface{}, ok bool) {
- return memCache.Load(key)
- }
- func Delete(key interface{}) {
- memCache.Delete(key)
- }
- func LoadAndDelete(key interface{}) (value interface{}, loaded bool) {
- return memCache.LoadAndDelete(key)
- }
- func LoadOrStore(key, value interface{}) (actual interface{}, loaded bool) {
- return memCache.LoadOrStore(key, value)
- }
- func Range(f func(key, value interface{}) bool) {
- memCache.Range(f)
- }
- func Store(key, value interface{}) {
- memCache.Store(key, value)
- }
|