Skip to content

Commit

Permalink
nil provider
Browse files Browse the repository at this point in the history
  • Loading branch information
hyorigo committed Jun 15, 2024
1 parent 3813edc commit b85a688
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ctor.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ func (s *Starbox) SetFS(hfs fs.FS) {
}

// SetScriptCache sets custom cache provider for script content.
// nil cache provider will disable script cache.
// It panics if called after execution.
func (s *Starbox) SetScriptCache(cache starlet.ByteCache) {
s.mu.Lock()
Expand All @@ -144,7 +145,11 @@ func (s *Starbox) SetScriptCache(cache starlet.ByteCache) {
if s.hasExec {
log.DPanic("cannot set script cache after execution")
}
s.mac.SetScriptCache(cache)
if cache == nil {
s.mac.SetScriptCacheEnabled(false)
} else {
s.mac.SetScriptCache(cache)
}

Check warning on line 152 in ctor.go

View check run for this annotation

Codecov / codecov/patch

ctor.go#L141-L152

Added lines #L141 - L152 were not covered by tests
}

// SetDynamicModuleLoader sets the dynamic module loader for preload and lazyload modules.
Expand Down

0 comments on commit b85a688

Please sign in to comment.