requests.connmanager

  • Declaration

    struct ConnManager;

    Keep opened connections for HTTP. It is actually cache over tuple(schema, host, port) -> connection with limited number of items.

    Discussion

    Evict least used.

    • put

      Declaration

      NetworkStream put(string schema, string host, ushort port, NetworkStream stream);

      put new stream in cache, evict old stream and return it. If nothing evicted return null. Returned(evicted) connection can be closed.

    • get

      Declaration

      NetworkStream get(string schema, string host, ushort port);

      Lookup connection.

    • del

      Declaration

      NetworkStream del(string schema, string host, ushort port);

      Remove connection from cache (without close).

    • Declaration

      void clear();

      clear cache (and close connections)