Skip to content

Notify when an LRU item is removed #729

@davidmartos96

Description

@davidmartos96

It would be useful to have some way of knowing when an item is removed from the LRU. If there is some cleanup/disposing logic that need to be done to the stored values, right now there is no way to do it when using a maximumSize, as the entries are removed implicitly.

I propose the following API

final lruMap = LruMap(
    onItemRemoved: (key, value) {
         value.dispose();
    },
)

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