def METHOD_NAME(key_pattern):
    """
    Deletes all cache keys that match key_pattern, if found.
    Note that not all cache backends support wildcards, or have a way to retrieve all keys.
    In this case, this function will just check if the key specified by key_pattern exists,
    and delete it if so.
    :param key_pattern: A string with a key name, can contain wildcard (*) characters
    :param for_view:
    :return: Number of keys deleted
    """
    if hasattr(django_cache, "delete_pattern"):
        return django_cache.delete_pattern(key_pattern)
    if django_cache.has_key(key_pattern):  # noqa: W601
        django_cache.delete(key_pattern)
        return 1
    return 0