nappa85 / include_uri

Proc-macro to include URI as literals at build time
2 stars 0 forks source link

caching support #1

Open Madoshakalaka opened 1 week ago

Madoshakalaka commented 1 week ago

Hi, it's ideal if the macro is able to cache the file content and only request the url once in a while to not slow down compilation. This can be done by looking at the Cache Expires and Etag headers etc to decide when to refetch.

I made an include_remote_str! macro with file system caching support powered by http_cache_reqwest.

In order to determine the cache location, I copied the workspace directory detection logic from sqlx's query! macro, should be tried and true.

I later looked up on crates.io and realized this crate already exists. It would be nice if you could integrate caching into your crate and I wouldn't mind you referencing my code.

nappa85 commented 1 week ago

PR are welcome!

Il giorno mer 6 nov 2024 alle ore 10:24 Siyuan Yan @.***> ha scritto:

Hi, it's ideal if the macro is able to cache the file content and only request the url once in a while to not slow down compilation. This can be done by looking at the Cache Expires and Etag headers etc to decide when to refetch.

I made an include_remote_str! macro with file system caching support powered by http_cache_reqwest.

In order to determine the cache location, I copied the workspace directory detection logic from sqlx's query! macro, should be tried and true.

I later looked up on crates.io and realized this crate already exists. It would be nice if you could integrate caching into your crate and I wouldn't mind you referencing my code.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Madoshakalaka commented 1 week ago

OK! I'll test my macro a bit more and make a PR if things appear OK!