Skip to content

Commit f6350ce

Browse files
committed
[host] add RefreshBootTimeCache function
This commit adds the RefreshBootTimeCache function, allowing users to manually refresh the cached boot time if they are using the `enableBootTimeCache` feature.
1 parent 642e1d7 commit f6350ce

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

host/host.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ func EnableBootTimeCache(enable bool) {
6969
enableBootTimeCache = enable
7070
}
7171

72+
// RefreshBootTimeCache manually refreshes the cached BootTime value.
73+
func RefreshBootTimeCache(ctx context.Context) error {
74+
_, err := common.BootTimeWithContext(ctx, false)
75+
return err
76+
}
77+
7278
func Info() (*InfoStat, error) {
7379
return InfoWithContext(context.Background())
7480
}

0 commit comments

Comments
 (0)