mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-09-01 12:25:43 +08:00
local cache
This commit is contained in:
parent
a84ad774f7
commit
2d21ab3aeb
@ -32,15 +32,23 @@ type cache[V any] struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *cache[V]) onEvict(key string, value V) {
|
func (c *cache[V]) onEvict(key string, value V) {
|
||||||
for k := range c.link.Del(key) {
|
lks := c.link.Del(key)
|
||||||
|
for k := range lks {
|
||||||
c.local.Del(k)
|
c.local.Del(k)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cache[V]) del(key ...string) {
|
func (c *cache[V]) del(key ...string) {
|
||||||
for _, k := range key {
|
for _, k := range key {
|
||||||
|
lks := c.link.Del(k)
|
||||||
c.local.Del(k)
|
c.local.Del(k)
|
||||||
|
//fmt.Println(">>>", lks)
|
||||||
|
for k := range lks {
|
||||||
|
c.local.Del(k)
|
||||||
|
//fmt.Println("+++", k)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
//fmt.Println()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cache[V]) Get(ctx context.Context, key string, fetch func(ctx context.Context) (V, error), opts ...*opt.Option) (V, error) {
|
func (c *cache[V]) Get(ctx context.Context, key string, fetch func(ctx context.Context) (V, error), opts ...*opt.Option) (V, error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user