Files
kubesphere/pkg/simple/client/cache/options.go
KubeSphere CI Bot 447a51f08b feat: kubesphere 4.0 (#6115)
* feat: kubesphere 4.0

Signed-off-by: ci-bot <ci-bot@kubesphere.io>

* feat: kubesphere 4.0

Signed-off-by: ci-bot <ci-bot@kubesphere.io>

---------

Signed-off-by: ci-bot <ci-bot@kubesphere.io>
Co-authored-by: ks-ci-bot <ks-ci-bot@example.com>
Co-authored-by: joyceliu <joyceliu@yunify.com>
2024-09-06 11:05:52 +08:00

33 lines
628 B
Go

package cache
import (
"fmt"
"kubesphere.io/kubesphere/pkg/server/options"
)
type Options struct {
Type string `json:"type"`
Options options.DynamicOptions `json:"options"`
}
// NewCacheOptions returns options points to nowhere,
// because redis is not required for some components
func NewCacheOptions() *Options {
return &Options{
Type: TypeInMemoryCache,
Options: map[string]interface{}{},
}
}
// Validate check options
func (r *Options) Validate() []error {
errors := make([]error, 0)
if r.Type == "" {
errors = append(errors, fmt.Errorf("invalid cache type"))
}
return errors
}