lostisland/faraday_middleware

Caching middleware can generate cache keys with #cache_key which are too long

Closed this issue · 4 comments

#cache_key in FaradayMiddleware::Caching (https://github.com/lostisland/faraday_middleware/blob/master/lib/faraday_middleware/response/caching.rb#L61) can generate cache keys that are too long for complex URLs.

This can lead to errors like Errno::ENAMETOOLONG: File name too long @ rb_sysopen.

I'm not really sure how best to go about fixing this, as obviously the uniqueness is important as it makes the cache per-identical request. Perhaps we could hash the keys in some way to get them to a uniform, shorter length?

Anyone there? ❤️

@timrogers sorry for being late on this one.

Hashing the url.request_uri before returning it seems like a reasonable solution!
Appreciate a lot of time has passed so you might not be interested in this anymore, but if you still are, I'd happily review a PR

Happy to look at this. Shouldn't be too complicated.

Fixed in #181 🎉!
Thanks again!