You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 rivejä
495 B

package cache
import "context"
// available operation.
const (
OperationGet = "get"
OperationSet = "set"
OperationDelete = "delete"
)
// OperationProvider creating a provider based on available operations.
func OperationProvider(prov map[string]func(ctx context.Context, item *Item) error) Provider {
return func(ctx context.Context, operation string, item *Item) error {
if method, ok := prov[operation]; ok {
return method(ctx, item)
}
return ErrOperationNotAllwed
}
}