* 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>
33 lines
628 B
Go
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
|
|
}
|