def hlen(key, host=None, port=None, db=None, password=None):
    '''
    Returns number of fields of a hash.

    .. versionadded:: 2017.7.0

    CLI Example:

    .. code-block:: bash

        salt '*' redis.hlen foo_hash
    '''
    server = _connect(host, port, db, password)
    return server.hlen(key)