[Python] Python in-memory cache that uses the disk when needed

Discussão em 'Python' iniciado por Stack, Março 9, 2025.

  1. Stack

    Stack Membro Participativo

    As the question says. What I'm looking for is a library that provides an in-memory cache - and there are many that do that. However, upon reaching some limit (eg 5 GB in-memory cache), instead of evicting, it should cache to disk (and only after it reaches another disk-only limit should it start evicting). Basically, a two-tier caching system with an in-memory bias (or at least making use of both), with the goal to maximise performance (as reading from disk would be faster than restarting from scratch).

    According to Copilot, DiskCache (https://grantjenks.com/docs/diskcache/) would be a good candidate, but that appears to be a disk-only cache rather than one making use of memory as well. Not sure if I'm missing something there.

    Continue reading...

Compartilhe esta Página