Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

How would one inspect the contents of the cache? #149

@blakepell

Description

@blakepell

The Dictionary list of Keys is not exposed in the MemoryCache class like it was in previous implementations (I believe this currently tracked in the _entries variable). I understand, the argument is that the list could be stale or even go stale as you iterate through it (I still think the benefit outweighs the known risk).

My issue is, how would someone inspect the contents of the cache in a diagnostics scenario? It seems like an awful lot of overhead to implement a cache manager of what might be there when the underlying Dictionary of keys could just be exposed like in past implementations (yes, it could be gone even during the iterating loop but it could also be gone at any request even if I'm tracking it). In the past this was blocking and not recommended for production environments (from MS documentation) but there are reasonable environments where you may want to do this (and the information is valuable when it's needed).

As reference, the Count property exposes the underlying dictionaries count with the comment "Gets the count of the current entries for diagnostic purposes".

I was able to fork the project, expose the keys and replace that assembly via a custom nuget feed. Is it possible to inspect the cache without an intervention like this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions