From 2dfbab4b84305c1ab5abea40dbf5bd84d93e524f Mon Sep 17 00:00:00 2001 From: William Forde Date: Sun, 1 Apr 2018 03:18:44 +0100 Subject: [PATCH] make changes mentioned in issue #4 --- script.module.codequick/lib/codequick/storage.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/script.module.codequick/lib/codequick/storage.py b/script.module.codequick/lib/codequick/storage.py index daa6063..653a721 100644 --- a/script.module.codequick/lib/codequick/storage.py +++ b/script.module.codequick/lib/codequick/storage.py @@ -98,6 +98,7 @@ def flush(self): def close(self): """Close file object.""" + self.flush() if self._stream: self._stream.close() self._stream = None @@ -125,6 +126,10 @@ class PersistentDict(_PersistentBase, MutableMapping): ``name`` can be a filename, or the full path to a file. The add-on profile directory will be the default location for files, unless a full path is given. + .. note:: + + If the 'ttl' parameter is given, any expired data will be removed on initialization. + .. note:: This class is also designed as a context manager. :Example: @@ -193,6 +198,10 @@ class PersistentList(_PersistentBase, MutableSequence): ``name`` can be a filename, or the full path to a file. The add-on profile directory will be the default location for files, unless a full path is given. + .. note:: + + If the 'ttl' parameter is given, any expired data will be removed on initialization. + .. note:: This class is also designed as a context manager. :Example: