Skip to content

Implement FIFO and LRU caches through a Map memory limit #1095

@mrj

Description

@mrj

I would like to allow a max_bytesize to be set for a Concurrent::Map, which would stop the combination of the map and its entries from getting any bigger by automatically deleting entries when a new one is added. Deletion of the oldest entry is easy through Hash#shift. New entries would automatically make a FIFO cache, while an LRU cache would need each accessed entry to be deleted and re-added.

Is this something worth working up a PR for? If so, does anyone have any suggestions on what to do and what not to do?

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