-
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
Follow up #1172 #1849: Fix cache issue. IP filtering helpers #1221
base: develop
Are you sure you want to change the base?
Conversation
Any update on when we might get this? |
Cherry picked from ThreeMammals#1221
@nurhat Wish you good luck during code review! And once again, |
Mohsen, could you review the code please? |
@garybond commented on Feb 10, 2021:
Coming soon... 😃 |
return string.Empty; | ||
} | ||
|
||
public static List<string> SplitCsv(this string csvList, bool nullOrWhitespaceInputReturnsNull = false) |
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.
could be private
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.
...till the moment the author will write at least one unit test for this method. 🤣
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.
unless no one uses it outside of this class
return string.Empty; | ||
} | ||
|
||
public static List<string> SplitCsv(this string csvList, bool nullOrWhitespaceInputReturnsNull = false) |
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.
public static List<string> SplitCsv(this string csvList, bool nullOrWhitespaceInputReturnsNull = false) | |
private static IReadOnlyCollection<string> SplitCsv(this string csvList, bool nullOrWhitespaceInputReturnsNull = false) |
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.
Ensuring about strong safety by IReadOnlyCollection
and making the method private
don't give much outcome by having it as read-only.
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.
this method is only use in this class, so, it must be private. There will always be time to make it public, if necessary
{ | ||
if (string.IsNullOrWhiteSpace(csvList)) | ||
{ | ||
return nullOrWhitespaceInputReturnsNull ? null : new List<string>(); |
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.
return nullOrWhitespaceInputReturnsNull ? null : new List<string>(); | |
return nullOrWhitespaceInputReturnsNull ? null : Array.Empty<string>(); |
.Split(',') | ||
.AsEnumerable() | ||
.Select(s => s.Trim()) | ||
.ToList(); |
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.
.ToList(); | |
.ToArray(); |
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.
@RaynaldM
Why to array?
The author just wants to match the returning type which is List<string>
😄
Are you kidding? 😉 He will get compilation error. 🤣
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.
if @nurhat applies all these changes no problems compiling.
I always recommend the use of Single-Dimensional Array because it is the most sober in memory and cpu.
If we don't need more functions, like in lists and other dictionaries, then let's use the simpler and more sober one
@RaynaldM Ray, |
} | ||
else | ||
{ | ||
Logger.LogDebug($"http request failed, could not create cache for {downstreamUrlKey}"); |
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.
There's a double space. Also message could be better, something like "http request failed, skipped caching for {downstreamUrlKey}"
|
@nurhat, are you available? The following issues need attention:
Should we agree to close this PR, or do you wish to keep it open for further rebase and development? |
Proposed Changes
CacheKeyGenerator