added resolve cache adapter API and memory cache

this refactors the god-object approach relying on HTTPX::Resolver and its helpers managing state, into an adapter layer on the HTTPX::Resolver::Cache namespace, for which a memory adapter, which implements the current default behaviour of in-memory LRU cache, was added. Other future adapters will have to implement the same API.

The cache is accessible via the options object resolver_cache method, which accepts :memory by default, but can also be given a custom cache object which implements the cache API.

This also fixes an issue whereby resolver cache access within a non main ractor was not thread-safe.

Closes #368

Merge request reports

Loading