mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-26 07:23:44 +00:00
refactor config cache
This commit is contained in:
6 files changed
+63
-38
No files matched your search
@@ -10,21 +10,21 @@ import (
|
||||
)
|
||||
|
||||
type JSONConfigLoader struct {
|
||||
*BaseConfigLoader
|
||||
cache ConfigCreatorCache
|
||||
idKey string
|
||||
configKey string
|
||||
}
|
||||
|
||||
func NewJSONConfigLoader(idKey string, configKey string) *JSONConfigLoader {
|
||||
func NewJSONConfigLoader(cache ConfigCreatorCache, idKey string, configKey string) *JSONConfigLoader {
|
||||
return &JSONConfigLoader{
|
||||
idKey: idKey,
|
||||
configKey: configKey,
|
||||
BaseConfigLoader: NewBaseConfigLoader(),
|
||||
idKey: idKey,
|
||||
configKey: configKey,
|
||||
cache: cache,
|
||||
}
|
||||
}
|
||||
|
||||
func (this *JSONConfigLoader) LoadWithID(raw []byte, id string) (interface{}, error) {
|
||||
config, err := this.CreateConfig(id)
|
||||
config, err := this.cache.CreateConfig(id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user