mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-01-12 03:37:31 -08:00
parent
2a3b26f9fd
commit
52c39b8d30
2
src/cache/duration.go
vendored
2
src/cache/duration.go
vendored
|
@ -9,6 +9,8 @@ type Duration string
|
|||
const (
|
||||
INFINITE = Duration("infinite")
|
||||
ONEWEEK = Duration("168h")
|
||||
ONEDAY = Duration("24h")
|
||||
TWOYEARS = Duration("17520h")
|
||||
)
|
||||
|
||||
func (d Duration) Seconds() int {
|
||||
|
|
|
@ -50,7 +50,7 @@ var toggleCmd = &cobra.Command{
|
|||
newToggles = append(newToggles, segment)
|
||||
}
|
||||
|
||||
env.Session().Set(cache.TOGGLECACHE, strings.Join(newToggles, ","), "1day")
|
||||
env.Session().Set(cache.TOGGLECACHE, strings.Join(newToggles, ","), cache.ONEDAY)
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ func setCachedFontData(assets []*Asset) {
|
|||
return
|
||||
}
|
||||
|
||||
environment.Cache().Set(cache.FONTLISTCACHE, string(data), "1day")
|
||||
environment.Cache().Set(cache.FONTLISTCACHE, string(data), cache.ONEDAY)
|
||||
}
|
||||
|
||||
func CascadiaCode() ([]*Asset, error) {
|
||||
|
|
|
@ -91,7 +91,7 @@ func (o *OAuthRequest) refreshToken(refreshToken string) (string, error) {
|
|||
|
||||
// add tokens to cache
|
||||
o.Env.Cache().Set(o.AccessTokenKey, tokens.AccessToken, cache.ToDuration(tokens.ExpiresIn))
|
||||
o.Env.Cache().Set(o.RefreshTokenKey, tokens.RefreshToken, "2years")
|
||||
o.Env.Cache().Set(o.RefreshTokenKey, tokens.RefreshToken, cache.TWOYEARS)
|
||||
return tokens.AccessToken, nil
|
||||
}
|
||||
|
||||
|
|
|
@ -591,7 +591,7 @@ func (term *Terminal) saveTemplateCache() {
|
|||
|
||||
templateCache, err := json.Marshal(tmplCache)
|
||||
if err == nil {
|
||||
term.sessionCache.Set(cache.TEMPLATECACHE, string(templateCache), "1day")
|
||||
term.sessionCache.Set(cache.TEMPLATECACHE, string(templateCache), cache.ONEDAY)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -757,7 +757,7 @@ func (term *Terminal) setPromptCount() {
|
|||
// Only update the count if we're generating a primary prompt.
|
||||
if term.CmdFlags.Primary {
|
||||
count++
|
||||
term.Session().Set(cache.PROMPTCOUNTCACHE, strconv.Itoa(count), "1day")
|
||||
term.Session().Set(cache.PROMPTCOUNTCACHE, strconv.Itoa(count), cache.ONEDAY)
|
||||
}
|
||||
|
||||
term.CmdFlags.PromptCount = count
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/jandedobbeleer/oh-my-posh/src/build"
|
||||
"github.com/jandedobbeleer/oh-my-posh/src/cache"
|
||||
"github.com/jandedobbeleer/oh-my-posh/src/runtime"
|
||||
"github.com/jandedobbeleer/oh-my-posh/src/runtime/http"
|
||||
)
|
||||
|
@ -83,7 +84,7 @@ func Notice(env runtime.Environment, force bool) (string, bool) {
|
|||
return "", false
|
||||
}
|
||||
|
||||
env.Cache().Set(CACHEKEY, latest, "1week")
|
||||
env.Cache().Set(CACHEKEY, latest, cache.ONEWEEK)
|
||||
|
||||
version := fmt.Sprintf("v%s", build.Version)
|
||||
if latest == version {
|
||||
|
|
Loading…
Reference in a new issue