Part of sasync.pdict View In Hierarchy
I am a database-persistent dictionary-like object with memory caching of items and lazy writing.
Getting, setting, or deleting my items returnsDeferred
objects of the Twisted asynchronous framework that fire when the underlying
database accesses are completed. Returning a deferred value avoids forcing
the client code to block while the real value is being read from the
database.
| Instance Variables | data | The in-memory dictionary that each instance of me uses to cache values for a given ID. |
| Method | __getitem__ | Returns a Deferred to the value of item name or the
value itself
|
| Method | __setitem__ | Sets item name to value, saving it to the database if there |
| Method | __delitem__ | Deletes item name, removing its entry from both the in-memory |
| Method | __contains__ | Indicates if I contain item key. |
| Method | keys | Returns an immediate or deferred list of the names of all my items in |
| Method | has_key | Returns an immediate or deferred Boolean indicating whether the key is |
| Method | clear | Clears the in-memory dictionary of all items and deletes all their |
| Method | iteritems | Only for preload mode: Iterate over all my items. |
| Method | iterkeys | Only for preload mode: Iterate over all my keys. |
| Method | itervalues | Only for preload mode: Iterate over all my values. |
| Method | items | Returns an immediate or deferred sequence of (name, value) tuples |
| Method | values | Returns an immediate or deferred sequence of all my values. |
| Method | get | Returns an immediate or deferred value of the value for the key |
| Method | setdefault | Sets my item specified by key to value if it doesn't exist |
| Method | copy | Returns an immediate or deferred copy of me that is a conventional |
Inherited from PersistentDictBase:
| Method | __init__ | Instantiates me with an item store keyed to the supplied hashable |
| Method | preload | This method preloads all my items from the database (which may take a |
| Method | shutdown | Shuts down my database Transactor and its
synchronous task queue.
|
| Method | loadAll | Loads all items from the database, setting my in-memory dict and key |
| Method | deferToWrites | @see: L{DeferredTracker.deferToAll} |
Returns a Deferred to the value of item name or the
value itself if in preload mode.
Indicates if I contain item key.
In preload mode, returns True if the item is present
in my in-memory dictionary and False if not.
In normal mode, returns an immediate Deferred firing with
True without a transaction if the item is already present in
my in-memory dictionary. If it isn't, tries to load the item (it will
probably be requested soon anyhow) and returns a Deferred that
will ultimately fire with True unless the load resulted in a
Missing object. In
that case, deletes the loaded Missing object from my in-memory
dictionary and fires the deferred with False.
<key> in <dict> Python construct
doesn't seem to work in normal mode. Use has_key
instead.