screenlets.backend.CachingBackend

Package screenlets :: Module backend :: Class CachingBackend |
[hide private]
[frames] | no frames]

# Class CachingBackend

source code

           object --+
                    |
    ScreenletsBackend --+
                        |
                       CachingBackend

A backend that stores the settings in arrays and saves after a short interval to avoid overhead when multiple values are set within a short time. The data gets saved into $HOME/.config/Screenlets/<Screenletname>/, in a file for each element (named like its id with the extension '.ini').

Instance Methods | [hide private]
__init__(self, path) x.__init__(...) initializes x; see help(type(x)) for signature | source code
delete_instance(self, id) Delete an instance from the list and from the filesystem. | source code
flush(self) Immediately save all pending data. | source code
save_option(self, id, name, value) Save option for an instance to cache and start saving-timeout for that element (value must be of type string). | source code
load_option(self, id, name) TODO: Load option from the backend (returned as str). | source code
load_instance(self, id) Load all options for the instance with the given id. | source code
__load_cache(self) Load all cached files from path. | source code
__save_cache(self) Save the cache (for all pending instances in queue) to self.path. | source code
__save_settings(self, filename, lst) Try to save settings in a file, first save this to a temporal file avoid encodings a disk full errors | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Class Variables | [hide private]
| __instances = ``{``}``
| __delay_time = `3000`
| __timeout = `None` hash(x)
| __queue = ``[``]``
| path = ``'````'``

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, path) (Constructor) | source code
x.__init__(...) initializes x; see help(type(x)) for signature Overrides: object.__init__ (inherited documentation)

### delete_instance(self, id) | source code
Delete an instance from the list and from the filesystem. Overrides: ScreenletsBackend.delete_instance

### flush(self) | source code
Immediately save all pending data. Overrides: ScreenletsBackend.flush

### save_option(self, id, name, value) | source code
Save option for an instance to cache and start saving-timeout for that element (value must be of type string). Overrides: ScreenletsBackend.save_option

### load_option(self, id, name) | source code
TODO: Load option from the backend (returned as str). Overrides: ScreenletsBackend.load_option

### load_instance(self, id) | source code
Load all options for the instance with the given id. Overrides: ScreenletsBackend.load_instance