Skip to content

Commit

Permalink
Merge pull request #994 from rsteube/doc-cache-key
Browse files Browse the repository at this point in the history
doc: update cache key
  • Loading branch information
rsteube authored Feb 17, 2024
2 parents 53f4f74 + 822bb79 commit e8de268
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 e8de268

Please sign in to comment.