<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def save_record(self, agent_id, t_step, key, value):
        '''
        Save a collection of records to the database.
        Database writes are cached.
        '''
        value = self.convert(key, value)
        self._tups.append(Record(agent_id=agent_id,
                                 t_step=t_step,
                                 key=key,
                                 value=value))
        if len(self._tups) > 100:
            self.flush_cache()