-
Notifications
You must be signed in to change notification settings - Fork 10k
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
HybridCache - rename RemoveKeyAsync and RemoveTagAsync to "By" #55332
Comments
Thank you for submitting this for API review. This will be reviewed by @dotnet/aspnet-api-review at the next meeting of the ASP.NET Core API Review group. Please ensure you take a look at the API review process documentation and ensure that:
|
Good! I like the "By" usage for the tags. For the
Here I'm not so sure. I got the simplification approach, and I kinda like it, but still not 100% sure... I went back and forth about maybe using NOTE: not being a native speaker I'm not 100% sure about if it should be
I totally agree: worth to point out the rationale here, but it's not an issue.
Agree, even though there is limited only to 1 tag, so the doubts about going plural still stands.
Agree. Also, even the new Just as a side note, in FusionCache I have both My 2 cents: I would go with To recap, an idea to play with: namespace Microsoft.Extensions.Caching.Hybrid;
public abstract class HybridCache
{
public abstract ValueTask RemoveAsync(string key, CancellationToken token = default);
public virtual ValueTask RemoveAsync(IEnumerable<string> keys, CancellationToken token = default)
public abstract ValueTask RemoveByTagAsync(string tag, CancellationToken token = default);
public virtual ValueTask RemoveByAnyTagAsync(IEnumerable<string> tags, CancellationToken token = default)
// or
public abstract ValueTask RemoveByTagAsync(string tag, CancellationToken token = default);
public virtual ValueTask RemoveByTagAsync(IEnumerable<string> tags, CancellationToken token = default)
} Just something for you all to think about, marinate a little bit, and see if it sticks. |
[API Review] We like @jodydonetti's point about RemoveByKey. namespace Microsoft.Extensions.Caching.Hybrid;
public abstract class HybridCache
{
- public abstract ValueTask RemoveKeyAsync(string key, CancellationToken token = default);
- public virtual ValueTask RemoveKeysAsync(IEnumerable<string> keys, CancellationToken token = default)
- public abstract ValueTask RemoveTagAsync(string tag, CancellationToken token = default);
- public virtual ValueTask RemoveTagsAsync(IEnumerable<string> tags, CancellationToken token = default)
+ public abstract ValueTask RemoveAsync(string key, CancellationToken token = default);
+ public virtual ValueTask RemoveAsync(IEnumerable<string> keys, CancellationToken token = default)
+ public abstract ValueTask RemoveByTagAsync(string tag, CancellationToken token = default);
+ public virtual ValueTask RemoveByTagAsync(IEnumerable<string> tags, CancellationToken token = default)
} Slight preference for no "Any" but approved either way. |
2. fix incorrect namespace of service extension types
Looks like this was done in #55732 |
This is a .NET 9 feature that is in preview 4 but is not yet GA.
It was raised in post-merge feedback that the "remove" naming is a little unclear/ambiguous/inconsistent - in particular, for
RemoveTagAsync
, we're not "removing a tag", we're removing other things (cache entries) by their tag. Cross-reference: #53255proposed:
This adds the
By
nomenclature, and removes the plurality (RemoveByTag
seems fine when taking multiple tags, andRemoveByTags
prompts the question as to whether a cache-entry needs to have all the tags). The ambiguity ofnull
(implicitly castable tostring
andIEnumerable<string>
) is not important; this is invalid both in terms of the API (via NRT) and implementation (null
is not really valid for either scanario; we have advised implementors to silently no-opnull
in the "tag" case, but we don't need to encourage it, and explicitnull
would already have been a compiler warning because of NRT).Additionally, this makes the API more consistent with
IOutputCacheStore
, which uses the nameEvictByTagAsync
, i.e. uses theBy
naming. TheEvict
vsRemove
is a separate discussion - happy to have that "now", but for comparison:IMemoryCache
usesRemove
;IDistributedCache
usesRemove
/RemoveAsync
; our main objective here is to clarify the "what by?".The text was updated successfully, but these errors were encountered: