Skip to content

Behavior of MemoryCache.GetValues did not match with dotnet API doc #4150

Open
@t-bzhan

Description

@t-bzhan

From the dotnet API doc, the behavior of MemoryCache.GetValues should be:

If a cache entry that is represented by the keys does not exist, the corresponding value for the returned object in the dictionary is set to null. Therefore, the returned dictionary always has the same number of items as the number of elements in keys.

However the actual behavior is that only those key value pairs stored in MemoryCache are returned.

image

I test the behavior with System.Runtime.Caching 4.7.0 in dotnet core, but the problem should exist for all versions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Pri3Indicates issues/PRs that are low priorityarea-System.MemoryuntriagedNew issue has not been triaged by the area owner

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions