group cache

This commit is contained in:
withchao
2023-02-10 10:48:49 +08:00
parent 6eb231aae4
commit 5d7809624c
5 changed files with 56 additions and 35 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ func GetCache[T any](ctx context.Context, rcClient *rockscache.Client, key strin
return t, nil
}
func GetCacheFor[E any, T any](ctx context.Context, rcClient *rockscache.Client, list []E, fn func(ctx context.Context, item E) (T, error)) ([]T, error) {
func GetCacheFor[E any, T any](ctx context.Context, list []E, fn func(ctx context.Context, item E) (T, error)) ([]T, error) {
rs := make([]T, 0, len(list))
for _, e := range list {
r, err := fn(ctx, e)