Skip to content

Use ValueTask instead of Task as async return value #132

@joakimriedel

Description

@joakimriedel

[Use the Thumbs Up reaction to vote for this feature, and please avoid adding comments like "+1" as they create noise for others watching the issue.]

I'm looking for a library to cache values at certain hot paths in my code.

Browsing through your API, I see that the async methods are returning Task and not ValueTask. The latter would be preferred since most of the requests would be cached and could be returned as T and not require the overhead of generating an actual Task<T> object.

Enhancement is to change GetAsync<T>, GetOrAddAsync<T> to return ValueTask<T>, but would require changing code all the way down to where T is actually returned in the providers to support ValueTask<T>. Perhaps for 3.0?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions