plabayo / rama

modular service framework to move and transform network packets
https://ramaproxy.org
Apache License 2.0
144 stars 13 forks source link

create http cache logic #45

Open GlenDC opened 8 months ago

GlenDC commented 8 months ago

The cache works on a resource level, what caches traditionally do, and allow you to work in context of the relevant HTTP RFC's to serve content from a cache (e.g. some file system available to the proxy), instead of making the request using the inner Service. Your typical cache basically.

Low prio item, available for others to pick up.

Feel free to be inspired by https://github.com/cloudflare/pingora/tree/main/pingora-cache, but don't copy code from it as-is, given this is licensed code, and not sure how we would need to comply with it if we would take code from it. It anyway is a different kind of way to structure proxies, so no direct mapping would be possible anyway. Just to say, a lot of the things you have to be careful about you can probably find there.

Oleksandr-Zatuleyev commented 1 month ago

What storage should be used for the cache? Pingora cache has an implementation for in-memory storage, but even it has a comment that it should be marked only for unit tests. Maybe Redis should be used for storage? This will allow multiple instances of the proxy to share the cache

GlenDC commented 1 month ago

Rama will provide an async trait for the storage. The implementations we provide will be Memory and Filesystem (fs). Any other possibilities can be implemented in community crates or by the lib user themselves.

Oleksandr-Zatuleyev commented 1 month ago

I would like to take up this task, if this issue is still low priority. I'm still learning Rust, so this should be good practice for me.

GlenDC commented 1 month ago

It is still open. Not the easiest issue though, design wise then. But feel free to come up with something and we can go from there. Or I can propose a design here and together we iterate on it here. Or whatever you want. Not urgent.