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.
This commit is contained in:
Goffi 2020-03-27 09:53:00 +01:00
commit 973beb4220

View file

@ -27,7 +27,7 @@ class MemoryNotInitializedError(Exception):
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 @@ class LazyPersistentBinaryDict(PersistentBinaryDict):
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