Skip to content
This repository has been archived by the owner on May 13, 2020. It is now read-only.

Commit

Permalink
Delete cache records for deleted items
Browse files Browse the repository at this point in the history
  • Loading branch information
kedder committed Aug 12, 2014
1 parent c5c39ea commit 835ed59
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/mongopersist/datamanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ def remove(self, obj):
# Now we remove the object from Mongo.
coll = self.get_collection_from_object(obj)
coll.remove({'_id': obj._p_oid.id})
if hash(obj._p_oid) in self._object_cache:
del self._object_cache[hash(obj._p_oid)]
# Edge case: The object was just added in this transaction.
if id(obj) in self._inserted_objects:
# but it still had to be removed from mongo, because insert
Expand Down

0 comments on commit 835ed59

Please sign in to comment.