-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🔥 Add Cache Invalidation Option to Cache Middleware #3036
Conversation
Thanks for opening this pull request! 🎉 Please check out our contributing guidelines. If you need help or want to chat with us, join us on Discord https://gofiber.io/discord |
WalkthroughThe update introduces the Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Client
participant CacheMiddleware
participant CacheStorage
Client->>CacheMiddleware: Request Data
CacheMiddleware->>CacheInvalidator: Check Cache Invalidator Function
CacheInvalidator-->>CacheMiddleware: Returns True/False
alt Cache Invalidated
CacheMiddleware->>CacheStorage: Invalidate Cache Entry
end
CacheMiddleware->>CacheStorage: Get Cache Data
CacheStorage-->>CacheMiddleware: Return Data
CacheMiddleware-->>Client: Respond with Data
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- docs/middleware/cache.md (2 hunks)
- docs/whats_new.md (1 hunks)
- middleware/cache/cache.go (1 hunks)
- middleware/cache/cache_test.go (1 hunks)
- middleware/cache/config.go (2 hunks)
Additional context used
Markdownlint
docs/middleware/cache.md
55-55: Column: 1 (MD010, no-hard-tabs)
Hard tabs
99-99: Column: 1 (MD010, no-hard-tabs)
Hard tabsdocs/whats_new.md
49-49: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
50-50: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
51-51: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
52-52: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
53-53: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
54-54: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
55-55: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
59-59: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
60-60: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
61-61: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
65-65: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
66-66: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
67-67: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
68-68: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
69-69: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
73-73: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
74-74: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
75-75: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
192-192: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
193-193: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
194-194: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
195-195: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
196-196: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
197-197: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
198-198: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
199-199: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
200-200: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
201-201: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
205-205: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
206-206: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
207-207: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
208-208: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
209-209: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
210-210: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
211-211: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
212-212: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
213-213: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
214-214: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
215-215: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
219-219: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
220-220: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
221-221: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
229-229: Expected: 0 or 2; Actual: 1 (MD009, no-trailing-spaces)
Trailing spaces
278-278: Expected: 0 or 2; Actual: 1 (MD009, no-trailing-spaces)
Trailing spaces
189-189: Expected: 1; Actual: 2 (MD012, no-multiple-blanks)
Multiple consecutive blank lines
242-242: Expected: 1; Actual: 2 (MD012, no-multiple-blanks)
Multiple consecutive blank lines
299-299: Expected: 1; Actual: 2 (MD012, no-multiple-blanks)
Multiple consecutive blank lines
259-259: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines
262-262: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines
143-143: null (MD031, blanks-around-fences)
Fenced code blocks should be surrounded by blank lines
171-171: null (MD031, blanks-around-fences)
Fenced code blocks should be surrounded by blank lines
23-23: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
260-260: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
LanguageTool
docs/whats_new.md
[grammar] ~51-~51: It looks like there is a word missing here. Did you mean “listen to config”? (LISTEN_TO_ME)
Context: ...ic.md) * app.Config properties moved to listen config * DisableStartupMessage * EnablePre...
[style] ~55-~55: This adverb was used twice in the sentence. Consider removing one of them or replacing them with a synonym. (ADVERB_REPETITION_PREMIUM)
Context: ...nablePrintRoutes * ListenerNetwork -> previously Network ### new methods * RegisterCus...
[uncategorized] ~192-~192: The official spelling of this programming framework is “Express.js”. (NODE_JS)
Context: ... ::: ### new methods * AutoFormat -> ExpressJs like * Host -> ExpressJs like * Port ->...
[uncategorized] ~193-~193: The official spelling of this programming framework is “Express.js”. (NODE_JS)
Context: ... AutoFormat -> ExpressJs like * Host -> ExpressJs like * Port -> ExpressJs like * IsProxy...
[uncategorized] ~194-~194: The official spelling of this programming framework is “Express.js”. (NODE_JS)
Context: ...like * Host -> ExpressJs like * Port -> ExpressJs like * IsProxyTrusted * Reset * Schema ...
[uncategorized] ~197-~197: The official spelling of this programming framework is “Express.js”. (NODE_JS)
Context: ...ke * IsProxyTrusted * Reset * Schema -> ExpressJs like * SendStream -> ExpressJs like * S...
[uncategorized] ~198-~198: The official spelling of this programming framework is “Express.js”. (NODE_JS)
Context: ...chema -> ExpressJs like * SendStream -> ExpressJs like * SendString -> ExpressJs like * S...
[uncategorized] ~199-~199: The official spelling of this programming framework is “Express.js”. (NODE_JS)
Context: ...tream -> ExpressJs like * SendString -> ExpressJs like * String -> ExpressJs like * ViewB...
[uncategorized] ~200-~200: The official spelling of this programming framework is “Express.js”. (NODE_JS)
Context: ...endString -> ExpressJs like * String -> ExpressJs like * ViewBind -> instead of Bind ###...
[grammar] ~253-~253: Do not use the singular ‘a’ before the plural noun ‘conditions’. (VB_A_JJ_NNS)
Context: ...ache management, allowing you to define a custom conditions for invalidating cache entries. ### CO...
[style] ~257-~257: Consider rephrasing this to strengthen your wording. (MAKE_CHANGES)
Context: ...idating cache entries. ### CORS We've made some changes to the CORS middleware to improve its f...
[uncategorized] ~265-~265: Loose punctuation mark. (UNLIKELY_OPENING_PUNCTUATION)
Context: ...updated fields: -Config.AllowOrigins
: Now accepts a slice of strings, each re...
[uncategorized] ~266-~266: Loose punctuation mark. (UNLIKELY_OPENING_PUNCTUATION)
Context: ... allowed origin. -Config.AllowMethods
: Now accepts a slice of strings, each re...
[uncategorized] ~267-~267: Loose punctuation mark. (UNLIKELY_OPENING_PUNCTUATION)
Context: ... allowed method. -Config.AllowHeaders
: Now accepts a slice of strings, each re...
[uncategorized] ~268-~268: Loose punctuation mark. (UNLIKELY_OPENING_PUNCTUATION)
Context: ...allowed header. -Config.ExposeHeaders
: Now accepts a slice of strings, each re...
Additional comments not posted (5)
middleware/cache/config.go (2)
34-38
: New propertyCacheInvalidation
added toConfig
struct. Ensure that the documentation is clear and the default value (nil
) is appropriate. This allows users to define custom logic for cache invalidation.
81-81
: The default value forCacheInvalidation
is set tonil
inConfigDefault
. This is consistent with the optional nature of this new feature.docs/middleware/cache.md (1)
65-73
: The documentation for theCacheInvalidation
function is clear and provides a practical example of usage. Ensure the example aligns with typical use cases and is easy to understand for users.docs/whats_new.md (1)
253-253
: The announcement of the new cache invalidation feature in the caching middleware is well-articulated. It clearly explains the benefit of allowing users to define custom conditions for invalidating cache entries.Tools
LanguageTool
[grammar] ~253-~253: Do not use the singular ‘a’ before the plural noun ‘conditions’. (VB_A_JJ_NNS)
Context: ...ache management, allowing you to define a custom conditions for invalidating cache entries. ### CO...middleware/cache/cache_test.go (1)
700-732
: The implementation ofTest_CacheInvalidation
looks thorough, correctly setting up the scenario to test the new cache invalidation feature. However, consider adding assertions for the HTTP status codes and possibly the cache headers to ensure that the cache is indeed being hit or missed as expected.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3036 +/- ##
==========================================
+ Coverage 82.78% 82.81% +0.02%
==========================================
Files 115 115
Lines 8227 8229 +2
==========================================
+ Hits 6811 6815 +4
+ Misses 1086 1084 -2
Partials 330 330
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@hcancelik I think the name doesnt make it clear what it is, it could be a func or param. Something more appropiate would be:
|
@gaby appreciate your feedback. I have renamed it to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- docs/middleware/cache.md (2 hunks)
- docs/whats_new.md (1 hunks)
- middleware/cache/cache.go (1 hunks)
- middleware/cache/cache_test.go (1 hunks)
- middleware/cache/config.go (2 hunks)
Files skipped from review as they are similar to previous changes (3)
- middleware/cache/cache.go
- middleware/cache/cache_test.go
- middleware/cache/config.go
Additional context used
Markdownlint
docs/middleware/cache.md
55-55: Column: 1 (MD010, no-hard-tabs)
Hard tabs
99-99: Column: 1 (MD010, no-hard-tabs)
Hard tabsdocs/whats_new.md
49-49: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
50-50: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
51-51: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
52-52: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
53-53: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
54-54: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
55-55: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
59-59: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
60-60: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
61-61: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
65-65: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
66-66: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
67-67: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
68-68: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
69-69: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
73-73: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
74-74: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
75-75: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
192-192: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
193-193: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
194-194: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
195-195: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
196-196: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
197-197: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
198-198: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
199-199: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
200-200: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
201-201: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
205-205: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
206-206: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
207-207: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
208-208: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
209-209: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
210-210: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
211-211: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
212-212: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
213-213: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
214-214: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
215-215: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
219-219: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
220-220: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
221-221: Expected: dash; Actual: asterisk (MD004, ul-style)
Unordered list style
229-229: Expected: 0 or 2; Actual: 1 (MD009, no-trailing-spaces)
Trailing spaces
278-278: Expected: 0 or 2; Actual: 1 (MD009, no-trailing-spaces)
Trailing spaces
189-189: Expected: 1; Actual: 2 (MD012, no-multiple-blanks)
Multiple consecutive blank lines
242-242: Expected: 1; Actual: 2 (MD012, no-multiple-blanks)
Multiple consecutive blank lines
299-299: Expected: 1; Actual: 2 (MD012, no-multiple-blanks)
Multiple consecutive blank lines
259-259: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines
262-262: Expected: 1; Actual: 0; Below (MD022, blanks-around-headings)
Headings should be surrounded by blank lines
143-143: null (MD031, blanks-around-fences)
Fenced code blocks should be surrounded by blank lines
171-171: null (MD031, blanks-around-fences)
Fenced code blocks should be surrounded by blank lines
23-23: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
260-260: null (MD032, blanks-around-lists)
Lists should be surrounded by blank lines
LanguageTool
docs/whats_new.md
[grammar] ~51-~51: It looks like there is a word missing here. Did you mean “listen to config”? (LISTEN_TO_ME)
Context: ...ic.md) * app.Config properties moved to listen config * DisableStartupMessage * EnablePre...
[style] ~55-~55: This adverb was used twice in the sentence. Consider removing one of them or replacing them with a synonym. (ADVERB_REPETITION_PREMIUM)
Context: ...nablePrintRoutes * ListenerNetwork -> previously Network ### new methods * RegisterCus...
[uncategorized] ~192-~192: The official spelling of this programming framework is “Express.js”. (NODE_JS)
Context: ... ::: ### new methods * AutoFormat -> ExpressJs like * Host -> ExpressJs like * Port ->...
[uncategorized] ~193-~193: The official spelling of this programming framework is “Express.js”. (NODE_JS)
Context: ... AutoFormat -> ExpressJs like * Host -> ExpressJs like * Port -> ExpressJs like * IsProxy...
[uncategorized] ~194-~194: The official spelling of this programming framework is “Express.js”. (NODE_JS)
Context: ...like * Host -> ExpressJs like * Port -> ExpressJs like * IsProxyTrusted * Reset * Schema ...
[uncategorized] ~197-~197: The official spelling of this programming framework is “Express.js”. (NODE_JS)
Context: ...ke * IsProxyTrusted * Reset * Schema -> ExpressJs like * SendStream -> ExpressJs like * S...
[uncategorized] ~198-~198: The official spelling of this programming framework is “Express.js”. (NODE_JS)
Context: ...chema -> ExpressJs like * SendStream -> ExpressJs like * SendString -> ExpressJs like * S...
[uncategorized] ~199-~199: The official spelling of this programming framework is “Express.js”. (NODE_JS)
Context: ...tream -> ExpressJs like * SendString -> ExpressJs like * String -> ExpressJs like * ViewB...
[uncategorized] ~200-~200: The official spelling of this programming framework is “Express.js”. (NODE_JS)
Context: ...endString -> ExpressJs like * String -> ExpressJs like * ViewBind -> instead of Bind ###...
[grammar] ~253-~253: Do not use the singular ‘a’ before the plural noun ‘conditions’. (VB_A_JJ_NNS)
Context: ...ache management, allowing you to define a custom conditions for invalidating cache entries. ### CO...
[style] ~257-~257: Consider rephrasing this to strengthen your wording. (MAKE_CHANGES)
Context: ...idating cache entries. ### CORS We've made some changes to the CORS middleware to improve its f...
[uncategorized] ~265-~265: Loose punctuation mark. (UNLIKELY_OPENING_PUNCTUATION)
Context: ...updated fields: -Config.AllowOrigins
: Now accepts a slice of strings, each re...
[uncategorized] ~266-~266: Loose punctuation mark. (UNLIKELY_OPENING_PUNCTUATION)
Context: ... allowed origin. -Config.AllowMethods
: Now accepts a slice of strings, each re...
[uncategorized] ~267-~267: Loose punctuation mark. (UNLIKELY_OPENING_PUNCTUATION)
Context: ... allowed method. -Config.AllowHeaders
: Now accepts a slice of strings, each re...
[uncategorized] ~268-~268: Loose punctuation mark. (UNLIKELY_OPENING_PUNCTUATION)
Context: ...allowed header. -Config.ExposeHeaders
: Now accepts a slice of strings, each re...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range and nitpick comments (2)
docs/middleware/cache.md (2)
65-73
: Clarify the usage ofCacheInvalidator
function to enhance understanding.The description of the
CacheInvalidator
function could be more detailed. Consider adding a sentence like: "Returntrue
if conditions such as specific query parameters or headers are met, which require the cache to be invalidated."
Line range hint
55-55
: Replace hard tabs with spaces for consistency.55c55 - CacheInvalidator: nil, + CacheInvalidator: nil, 99c99 - CacheInvalidator: nil, + CacheInvalidator: nil, 101c101 - CacheInvalidator: nil, + CacheInvalidator: nil,Also applies to: 99-99, 101-101
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- docs/middleware/cache.md (2 hunks)
Additional context used
Markdownlint
docs/middleware/cache.md
55-55: Column: 1 (MD010, no-hard-tabs)
Hard tabs
99-99: Column: 1 (MD010, no-hard-tabs)
Hard tabs
101-101: Column: 1 (MD010, no-hard-tabs)
Hard tabs
Additional comments not posted (1)
docs/middleware/cache.md (1)
83-83
: Ensure the description ofCacheInvalidator
is clear and informative.The provided description is succinct and clearly states the purpose of the function. However, consider adding practical examples or scenarios where this might be particularly useful to help users better understand when to use this feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- docs/middleware/cache.md (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- docs/middleware/cache.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range and nitpick comments (1)
docs/middleware/cache.md (1)
83-83
: Ensure the description ofCacheInvalidator
is comprehensive.The description of
CacheInvalidator
is good but could be enhanced by specifying typical use cases or conditions under which cache invalidation might be necessary, such as changes in user session data or specific request headers.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- docs/middleware/cache.md (1 hunks)
Additional context used
Markdownlint
docs/middleware/cache.md
55-55: Column: 1 (MD010, no-hard-tabs)
Hard tabs
Additional comments not posted (2)
docs/middleware/cache.md (2)
65-73
: Clarify the description forCacheInvalidator
.The description of the
CacheInvalidator
function in the example could be more detailed. It is important to explain under what circumstances a user might want to returntrue
to invalidate the cache. Consider adding a sentence like: "Returntrue
if conditions such as specific query parameters or headers are met, which require the cache to be invalidated."
101-101
: Replace hard tabs with spaces in Markdown files.This is important for ensuring that the documentation renders correctly across different platforms and editors.
- CacheInvalidator: nil, + CacheInvalidator: nil,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- docs/middleware/cache.md (1 hunks)
Additional context used
Markdownlint
docs/middleware/cache.md
55-55: Column: 1 (MD010, no-hard-tabs)
Hard tabs
73-73: null (MD031, blanks-around-fences)
Fenced code blocks should be surrounded by blank lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range and nitpick comments (1)
docs/middleware/cache.md (1)
65-75
: The example and description for theCacheInvalidator
function are clear and informative. However, consider adding a brief explanation of the function's role within the cache flow in the initial introduction of theCacheInvalidator
to provide a smoother learning curve for new users.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- docs/middleware/cache.md (1 hunks)
Additional context used
Learnings (1)
docs/middleware/cache.md (1)
User: hcancelik PR: gofiber/fiber#3036 File: docs/middleware/cache.md:103-103 Timestamp: 2024-06-15T19:26:06.401Z Learning: There are no hard tabs in the lines 100 to 105 of the `docs/middleware/cache.md` file. Future comments about formatting should accurately reflect the actual content.
Markdownlint
docs/middleware/cache.md
55-55: Column: 1 (MD010, no-hard-tabs)
Hard tabs
Additional comments not posted (2)
docs/middleware/cache.md (2)
85-85
: The definition forCacheInvalidator
is well-documented. It's clear how it functions and when it should returntrue
. This aligns with the PR's objective to enhance cache management flexibility.
103-103
: The default configuration setup inConfigDefault
is correctly updated to reflect the newCacheInvalidator
functionality. This ensures that users are aware of the default behavior when they do not specify any configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Congrats on merging your first pull request! 🎉 We here at Fiber are proud of you! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord |
Description
This is a new option for the cache middleware to invalidate the cache. This is based on the discussion at #3034
Changes introduced
Type of change
Checklist
/docs/
directory for Fiber's documentation.