MCPcopy Index your code
hub / github.com/python/cpython / check_cache

Method check_cache

Lib/urllib/request.py:1597–1615  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1595 return conn
1596
1597 def check_cache(self):
1598 # first check for old ones
1599 t = time.time()
1600 if self.soonest <= t:
1601 for k, v in list(self.timeout.items()):
1602 if v < t:
1603 self.cache[k].close()
1604 del self.cache[k]
1605 del self.timeout[k]
1606 self.soonest = min(list(self.timeout.values()))
1607
1608 # then check the size
1609 if len(self.cache) == self.max_conns:
1610 for k, v in list(self.timeout.items()):
1611 if v == self.soonest:
1612 del self.cache[k]
1613 del self.timeout[k]
1614 break
1615 self.soonest = min(list(self.timeout.values()))
1616
1617 def clear_cache(self):
1618 for conn in self.cache.values():

Callers 1

connect_ftpMethod · 0.95

Calls 5

listClass · 0.85
timeMethod · 0.45
itemsMethod · 0.45
closeMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected