Add caching template for gowrap#111
Merged
hexdigest merged 2 commits intoMay 26, 2026
Merged
Conversation
- Add templates/caching with in-memory caching using go-cache - Cache successful method results based on method name + parameters - Skip caching for void methods and error results - Thread-safe implementation with configurable expiration - Comprehensive test coverage for all caching scenarios - Follows existing gowrap template patterns and conventions
Contributor
Author
|
Hey there @hexdigest , |
hexdigest
reviewed
May 26, 2026
| {{- if and $method.HasResults (not $method.ReturnsError)}} | ||
| _key := "{{$method.Name}}" | ||
| {{- range $param := $method.Params}} | ||
| _key += fmt.Sprintf(":%v", {{$param.Name}}) |
hexdigest
reviewed
May 26, 2026
| {{- else if and $method.HasResults $method.ReturnsError}} | ||
| _key := "{{$method.Name}}" | ||
| {{- range $param := $method.Params}} | ||
| _key += fmt.Sprintf(":%v", {{$param.Name}}) |
Contributor
Author
|
Hi @hexdigest let me know if anything else is needed. |
Owner
|
@retr0-kernel thanks for your contribution! |
Contributor
Author
|
No worries @hexdigest. Just wanted to know one thing, are you still actively maintaining this repo? Would love to help you maintain it and continue this. Thanks |
Owner
|
Yeah I'm on it, things got busy in the past year but I'll try to keep up. |
Contributor
Author
|
No issues let me know if i can help would love to help in as a maintainer. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Caching Template for GoWrap
This PR adds a new
cachingtemplate that automatically instruments Go interfaces with in-memory caching.Features
sync.RWMutexfor concurrent accessUsage