Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: LRU cache #472

Open
positron96 opened this issue Nov 23, 2021 · 4 comments
Open

Feature request: LRU cache #472

positron96 opened this issue Nov 23, 2021 · 4 comments
Assignees

Comments

@positron96
Copy link

All in the title. Considering the great assortment of utility containers and algorithms in ETL, it would be nice to have some cache of fixed size that automatically delets old entries.

Or, better yet, extend the framework to caches with different eviction policies.

@jwellbelove
Copy link
Contributor

I actually started looking at cache containers several years ago, but never got further than an interface (etl::icache) and a simple LRU cache example at the time.
Maybe it's time to look at it again. 👍

@positron96
Copy link
Author

Thanks for prompt response!

Upon looking at icache.h I've realized that we are talking about different caches. What I mean is a generic data container that is basically a map of fixed size that deletes oldest (oldest read / first inserted, whatever) values when inserting new value over capacity (API of such container is basically a get/put/contains set of methods). icache.h seems to be a caching IO system that caches data from some backend via write_store/read_store.

Examples of a generic memory cache can be seen in

Most implementations contain a map that stores insertion order (e.g. via a double-linked list)

@positron96
Copy link
Author

positron96 commented Nov 23, 2021

When there is a general purpose in-memory cache, it can be (almost trivially) used to build an IO cache that wraps a backend.

@jwellbelove
Copy link
Contributor

Good point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

2 participants