def __setitem__(self, index: Union[SchemaKey, int], schema: dict) -> dict:
LOGGER.debug('<STR_LIT>', index, schema)<EOL>if isinstance(index, SchemaKey):<EOL><INDENT>self._schema_key2schema[index] = schema<EOL>self._seq_no2schema_key[schema['<STR_LIT>']] = index<EOL><DEDENT>elif isinstance(index, int):<EOL><INDENT>s_key = schema_key(schema['<STR_LIT:id>'])<EOL>self._schema_key2schema[s_key] = schema<EOL>self._seq_no2schema_key[index] = s_key<EOL><DEDENT>else:<EOL><INDENT>LOGGER.debug('<STR_LIT>', index)<EOL>raise CacheIndex('<STR_LIT>'.format(index))<EOL><DEDENT>LOGGER.debug('<STR_LIT>', schema)<EOL>return schema<EOL>
Put schema into cache and return it.

:param index: schema key or sequence number
:param schema: schema to put into cache
:return: input schema