def update_keys(self, keys):
""" Add new IDs to cache.
:param list keys: list of new IDs to be added to cache
:return: self
:rtype: ObjectCache
"""
if not self:
# for large amounts of data, this may be faster (no need for set
# and difference calls)
self.update({cid: {'id': cid} for cid in keys})
else:
self.update({cid: {'id': cid}
for cid in set(keys).difference(six.viewkeys(self))})
return self
评论列表
文章目录