Skip to content

Commit

Permalink
doc: update cache key
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Feb 17, 2024
1 parent 53f4f74 commit 822bb79
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/src/carapace/action/cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ carapace.ActionCallback(func(c carapace.Context) carapace.Action {

## Key

Additional keys like [`cache.String`] can be passed as well.
Additional keys like [`key.String`] can be passed as well.

```go
carapace.ActionMultiParts("/", func(c carapace.Context) carapace.Action {
Expand All @@ -29,7 +29,7 @@ carapace.ActionMultiParts("/", func(c carapace.Context) carapace.Action {
return carapace.ActionValues(
time.Now().Format("15:04:05"),
)
}).Cache(10*time.Second, cache.String(c.Parts[0]))
}).Cache(10*time.Second, key.String(c.Parts[0]))
default:
return carapace.ActionValues()
}
Expand All @@ -56,9 +56,9 @@ Cache is written as `json` to [`os.UserCacheDir`] using the [Export] format.

[Action]:../action.md
[`Cache`]:https://pkg.go.dev/github.com/rsteube/carapace#Action.Cache
[`cache.String`]:https://pkg.go.dev/github.com/rsteube/carapace/pkg/cache#String
[`key.String`]:https://pkg.go.dev/github.com/rsteube/carapace/pkg/key#String
[`CacheKeys`]:https://pkg.go.dev/github.com/rsteube/carapace/pkg/cache#CacheKey
[callback actions]:./defaultActions/actionCallback.md
[Export]:../export.md
[`os.UserCacheDir`]:https://pkg.go.dev/os#UserCacheDir
[`runtime.Caller`]:https://pkg.go.dev/runtime#Caller
[`runtime.Caller`]:https://pkg.go.dev/runtime#Caller

0 comments on commit 822bb79

Please sign in to comment.