def check_cache(self, type, data, obj=None):
try:<EOL><INDENT>id = data['<STR_LIT:id>']<EOL><DEDENT>except:<EOL><INDENT>return data<EOL><DEDENT>try:<EOL><INDENT>type = obj._get_type()<EOL><DEDENT>except:<EOL><INDENT>pass<EOL><DEDENT>try:<EOL><INDENT>hit = self.item_cache[type][id]<EOL><DEDENT>except KeyError:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>hit._update_data(data)<EOL>return hit<EOL><DEDENT>if not obj:<EOL><INDENT>obj = self.item_class.get(type, Redmine_Item)<EOL><DEDENT>new_item = obj(redmine=self, data=data, type=type)<EOL>self.item_cache.setdefault(type, {})[id] = new_item<EOL>return new_item<EOL>
Returns the updated cached version of the given dict