dns-cache icon indicating copy to clipboard operation
dns-cache copied to clipboard

Caching does not work with default args

Open Kemaweyan opened this issue 2 years ago • 0 comments

This code does not work

import requests

dns_cache.override_system_resolver()

for i in range(10):
     requests.get('http://www.coala.io/')

It does not speed up requests but makes them even slowly. Looking into the library code I found that the get method is being called for the dns_cache.hosts.HostsCache object, but the put method calls - for dns_cache.expiration.MinExpirationCache. Of course, it could cache nothing because the self.data dicts are different and the get method could not find items stored in the put method of another object.

Kemaweyan avatar Dec 05 '23 17:12 Kemaweyan