def cache(self, con):
if self._maxusage and con.usage_count > self._maxusage:<EOL><INDENT>self._connections -=<NUM_LIT:1><EOL>logging.debug('<STR_LIT>' % (con.usage_count, self._maxusage))<EOL>con._close()<EOL>return<EOL><DEDENT>self._condition.acquire()<EOL>if con in self._idle_cache:<EOL><INDENT>self._condition.release()<EOL>return<EOL><DEDENT>try:<EOL><INDENT>if not self._maxcached or len(self._idle_cache) < self._maxcached:<EOL><INDENT>self._idle_cache.append(con)<EOL><DEDENT>else: <EOL><INDENT>logging.debug('<STR_LIT>' % (len(self._idle_cache), self._maxcached))<EOL>con._close() <EOL><DEDENT>self._condition.notify()<EOL><DEDENT>finally:<EOL><INDENT>self._connections -= <NUM_LIT:1><EOL>self._condition.release()<EOL><DEDENT>
Put a dedicated connection back into the idle cache.