# Internal LRU cache implementation

- Thread: https://externals.io/message/103006
- Original archive: https://news-web.php.net/php.internals/103006
- Started by Josh Di Fabio on 2018-08-01T09:29:10+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #103006 — Josh Di Fabio — 2018-08-01T09:29:10+00:00

URL: https://externals.io/message/103006#103006

Hello internals,

In my experience, LRU cache is a common pattern in userland. Each time
I write one in PHP, I suspect that it would probably be much more
efficient if it was implemented in C.

If this is indeed a very common pattern, and it would be much more
efficient implemented internally, is there any appetite for an
internal implementation of LRU cache?

I would suggest the following interface as a starting point:

__construct(int size)
resize(int n)
get(scalar key)
set(scalar key, value)
remove(scalar key)

Thanks for your time
