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

def add(self, item, safe=None):
		''' Add an item into the queue of things to be inserted.  Does not flush.'''
		item._set_session(self)
		if safe is None:
			safe = self.safe
		self.queue.append(SaveOp(self.transaction_id, self, item, safe))
		# after the save op is recorded, the document has an _id and can be
		# cached
		self.cache_write(item)
		if self.autoflush:
			return self.flush()