first commit
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
andrey1s
2021-04-26 17:13:36 +03:00
commit 7da0cd57ce
45 changed files with 3703 additions and 0 deletions

22
provider/ns/provider.go Normal file
View File

@@ -0,0 +1,22 @@
package ns
import (
"context"
"errors"
"gitoa.ru/go-4devs/cache"
)
var ErrProviderNotFound = errors.New("provider not found")
func New(providers map[string]cache.Provider) cache.Provider {
return func(ctx context.Context, operation string, item *cache.Item) error {
if prov, ok := providers[item.Key.Prefix]; ok {
item.Key.Prefix = ""
return prov(ctx, operation, item)
}
return ErrProviderNotFound
}
}