github.com/benz9527/toy-box/algo@v0.0.0-20240221120937-66c0c6bd5abd/kv/map_intf.go (about) 1 package kv 2 3 import ( 4 "io" 5 ) 6 7 type SafeStoreKeyFilterFunc func(key string) bool 8 9 func defaultAllKeysFilter(key string) bool { 10 return true 11 } 12 13 type IThreadSafeStore[T any] interface { 14 io.Closer 15 AddOrUpdate(key string, obj T) 16 Replace(items map[string]T) 17 Delete(key string) 18 Get(key string) (item T, exists bool) 19 ListKeys(filters ...SafeStoreKeyFilterFunc) []string 20 ListValues(keys ...string) (items []T) 21 }