mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-18 19:45:24 +00:00
Merge pull request #3322 from projectdiscovery/optional-templates-cache
Added optional doNotCache to protocols.ExecuterOptions
This commit is contained in:
commit
dbb0bf2789
@ -77,6 +77,9 @@ type ExecuterOptions struct {
|
|||||||
|
|
||||||
Operators []*operators.Operators // only used by offlinehttp module
|
Operators []*operators.Operators // only used by offlinehttp module
|
||||||
|
|
||||||
|
// DoNotCache bool disables optional caching of the templates structure
|
||||||
|
DoNotCache bool
|
||||||
|
|
||||||
Colorizer aurora.Aurora
|
Colorizer aurora.Aurora
|
||||||
WorkflowLoader model.WorkflowLoader
|
WorkflowLoader model.WorkflowLoader
|
||||||
ResumeCfg *types.ResumeCfg
|
ResumeCfg *types.ResumeCfg
|
||||||
|
|||||||
@ -34,8 +34,10 @@ func init() {
|
|||||||
//
|
//
|
||||||
//nolint:gocritic // this cannot be passed by pointer
|
//nolint:gocritic // this cannot be passed by pointer
|
||||||
func Parse(filePath string, preprocessor Preprocessor, options protocols.ExecuterOptions) (*Template, error) {
|
func Parse(filePath string, preprocessor Preprocessor, options protocols.ExecuterOptions) (*Template, error) {
|
||||||
if value, err := parsedTemplatesCache.Has(filePath); value != nil {
|
if !options.DoNotCache {
|
||||||
return value.(*Template), err
|
if value, err := parsedTemplatesCache.Has(filePath); value != nil {
|
||||||
|
return value.(*Template), err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var reader io.ReadCloser
|
var reader io.ReadCloser
|
||||||
@ -69,7 +71,9 @@ func Parse(filePath string, preprocessor Preprocessor, options protocols.Execute
|
|||||||
template.CompiledWorkflow.Options = &options
|
template.CompiledWorkflow.Options = &options
|
||||||
}
|
}
|
||||||
template.Path = filePath
|
template.Path = filePath
|
||||||
parsedTemplatesCache.Store(filePath, template, err)
|
if !options.DoNotCache {
|
||||||
|
parsedTemplatesCache.Store(filePath, template, err)
|
||||||
|
}
|
||||||
return template, nil
|
return template, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user