Skip to content

Add metric or hook to let user know whether they should increase cache size or not #139

Description

@crclz

Are there any plans to add metrics that can help users decide whether the cache is too small or too large?

  • scenario 1: The cache size is too large.

    • In this scenario, a metric of cache space usage (e.g. xx%) can let user know how many space can be cut off to save memory resource.
    • NOTE: I did not find such metrics in other byte cache libraries.
  • scenario 2: The cache size is too small, causing most entries to be evicted one or two seconds after being added to the cache.

    • In this scenario, user should increase the cache size. A metric of average entry life time seconds will let user know whether the cache is too small or not. If metric is too expensive, I think at least freecache could provide a OnEvicted hook (like OnRemoveWithMetadata in BigCache, but I did not find one in freecache), so that user can monitor the eviction event.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions