mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-06 02:23:10 +08:00
feat: local cache
This commit is contained in:
parent
a81bc3fc23
commit
749eb11830
@ -6,10 +6,32 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type LRU1[K comparable, V any] interface {
|
||||
Get(key K, fetch func() (V, error)) (V, error)
|
||||
Del(key K) bool
|
||||
Stop()
|
||||
}
|
||||
|
||||
//type expirableLRU[K comparable, V any] struct {
|
||||
// core expirable.LRU[K, V]
|
||||
//}
|
||||
//
|
||||
//func (x *expirableLRU[K, V]) Get(key K, fetch func() (V, error)) (V, error) {
|
||||
//
|
||||
// return x.core.Get(key, fetch)
|
||||
//}
|
||||
//
|
||||
//func (x *expirableLRU[K, V]) Del(key K) bool {
|
||||
// return x.core.Remove(key)
|
||||
//}
|
||||
//
|
||||
//func (x *expirableLRU[K, V]) Stop() {
|
||||
//
|
||||
//}
|
||||
|
||||
type waitItem[V any] struct {
|
||||
lock sync.Mutex
|
||||
expires int64
|
||||
active bool
|
||||
err error
|
||||
value V
|
||||
}
|
||||
@ -80,3 +102,7 @@ func (x *LRU[K, V]) Del(key K) bool {
|
||||
x.lock.Unlock()
|
||||
return ok
|
||||
}
|
||||
|
||||
func (x *LRU[K, V]) Stop() {
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user