def clear_cache(ip=None):
if ip:<EOL><INDENT>with ignored(Exception):<EOL><INDENT>client = CLIENT_CACHE[ip]<EOL>del CLIENT_CACHE[ip]<EOL>client.close()<EOL><DEDENT><DEDENT>else:<EOL><INDENT>for client in CLIENT_CACHE.values():<EOL><INDENT>with ignored(Exception):<EOL><INDENT>client.close()<EOL><DEDENT><DEDENT>CLIENT_CACHE.clear()<EOL><DEDENT>
Clear the client cache or remove key matching the given ip.