flexget.utils.simple_persistence module#

NOTE: Avoid using this module on your own or in plugins, this was originally made for 0.9 -> 1.0 transition.

You can safely use task.simple_persistence and manager.persist, if we implement something better we can replace underlying mechanism in single point (and provide transparent switch).

class flexget.utils.simple_persistence.SimpleKeyValue(task, plugin, key, value)[source]#

Bases: VersionedBase

_json#
_sa_class_manager = {'_json': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'added': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'key': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'plugin': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'task': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'value': <sqlalchemy.orm.attributes.create_proxied_attribute.<locals>.Proxy object>}#
added#
id#
key#
plugin#
task#
value#
class flexget.utils.simple_persistence.SimplePersistence(plugin=None)[source]#

Bases: MutableMapping

Store simple values that need to be persisted between FlexGet runs. Interface is like a dict.

This should only be used if a plugin needs to store a few values, otherwise it should create a full table in the database.

classmethod flush(task=None)[source]#

Flush all in memory key/values to database.

classmethod load(task=None)[source]#

Load all key/values from task into memory from database.

_abc_impl = <_abc._abc_data object>#
class_store = {}#
property store#
class flexget.utils.simple_persistence.SimpleTaskPersistence(task)[source]#

Bases: SimplePersistence

_abc_impl = <_abc._abc_data object>#
property plugin#
flexget.utils.simple_persistence.db_cleanup(manager, session)[source]#

Clean up values in the db from tasks which no longer exist.

flexget.utils.simple_persistence.flush_task(task)[source]#

Store all in memory key/value pairs to database when a task has completed.

flexget.utils.simple_persistence.flush_taskless(manager)[source]#
flexget.utils.simple_persistence.load_task(task)[source]#

Load all key/value pairs into memory before a task starts.

flexget.utils.simple_persistence.load_taskless(manager)[source]#

Load all key/value pairs into memory which aren’t associated with a specific task.