def METHOD_NAME(doctype: str | None = None):
	from frappe.desk.notifications import delete_notification_count_for
	for key in ("is_table", "doctype_modules"):
		frappe.cache.delete_value(key)
	def clear_single(dt):
		frappe.clear_document_cache(dt)
		for name in doctype_cache_keys:
			frappe.cache.hdel(name, dt)
	if doctype:
		clear_single(doctype)
		# clear all parent doctypes
		for dt in frappe.get_all(
			"DocField", "parent", dict(fieldtype=["in", frappe.model.table_fields], options=doctype)
		):
			clear_single(dt.parent)
		# clear all parent doctypes
		if not frappe.flags.in_install:
			for dt in frappe.get_all(
				"Custom Field", "dt", dict(fieldtype=["in", frappe.model.table_fields], options=doctype)
			):
				clear_single(dt.dt)
		# clear all notifications
		delete_notification_count_for(doctype)
	else:
		# clear all
		for name in doctype_cache_keys:
			frappe.cache.delete_value(name)
		frappe.cache.delete_keys("document_cache::")