# HG changeset patch # User Goffi # Date 1585299180 -3600 # Node ID 78fea49735c555977cda00734991a6164b0e2032 # Parent 8770397f8f82ac4fdd21fd6492d63dd12be1edb5 core (memory/persistent): added `aset` method in LazyPersistentBinaryDict: this method does the same as `force` but is there to be consistent with PersistentDict. `force` should be removed in the future. diff -r 8770397f8f82 -r 78fea49735c5 sat/memory/persistent.py --- a/sat/memory/persistent.py Fri Mar 27 09:50:42 2020 +0100 +++ b/sat/memory/persistent.py Fri Mar 27 09:53:00 2020 +0100 @@ -27,7 +27,7 @@ pass -class PersistentDict(object): +class PersistentDict: r"""A dictionary which save persistently each value assigned /!\ be careful, each assignment means a database write @@ -250,6 +250,13 @@ d.addErrback(self._defaultOrException, default=default) return d + def aset(self, key, value): + """Async set, return a Deferred fired when value is actually stored""" + # FIXME: redundant with force, force must be removed + # XXX: similar as PersistentDict.aset, but doesn't use cache + return self.storage.setPrivateValue(self.namespace, key, value, + self.binary, self.profile) + def setdefault(self, key, default): raise NotImplementedError