Collections

These datastructures are used to implement the behaviour of various urllib3 components in a decoupled and application-agnostic design.

class urllib3._collections.RecentlyUsedContainer(maxsize: int = 10, dispose_func: Callable[[_VT], None] | None = None)[source]

Provides a thread-safe dict-like container which maintains up to maxsize keys while throwing away the least-recently-used keys beyond maxsize.

Parameters:
  • maxsize – Maximum number of recent elements to retain.

  • dispose_func – Every time an item is evicted from the container, dispose_func(value) is called. Callback which will get called

clear() None.  Remove all items from D.[source]
keys() a set-like object providing a view on D's keys[source]