Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add in_memory storage option #2356

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/source/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1634,7 +1634,7 @@ persistent_store
----------------

* Default: ``localStorage``
* Valid options: ``localStorage``, ``IndexedDB``, ``sessionStorage``, ``BrowserExtLocal``, ``BrowserExtSync``
* Valid options: ``localStorage``, ``IndexedDB``, ``sessionStorage``, ``BrowserExtLocal``, ``BrowserExtSync``, ``none``

Determines which store is used for storing persistent data.

Expand All @@ -1656,6 +1656,8 @@ Items in sync storage are synced by the browser and are available across all ins
BrowserExtLocal represents the local storage area.
Items in local storage are local to the machine the extension was installed on

When using ``persistent_store: 'none'`` Converse will store data in-memory thus clearing all data across page reloads.
It is useful if memory storage limitations are beinig reached and refetching data anew after a reload is acceptable.

push_app_servers
----------------
Expand Down
3 changes: 3 additions & 0 deletions src/headless/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,9 @@ function initPersistentStorage () {
} else if (_converse.api.settings.get("persistent_store") === 'IndexedDB') {
config['description'] = 'indexedDB instance';
config['driver'] = [Storage.localForage.INDEXEDDB];
} else if (_converse.api.settings.get("persistent_store") === 'none') {
config['description'] = 'in-memory instance';
config['driver'] = [Storage.IN_MEMORY];
}
_converse.storage['persistent'] = Storage.localForage.createInstance(config);
}
Expand Down
2 changes: 1 addition & 1 deletion src/headless/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"gitHead": "9641dcdc820e029b05930479c242d2b707bbe8e2",
"devDependencies": {
"@converse/skeletor": "conversejs/skeletor#56a284bd36a07977d69c08d78e7c8c0fc9fc5c87",
"@converse/skeletor": "conversejs/skeletor#00424495db10ed68ee43aa5d471619db5d58ce96",
"filesize": "^6.1.0",
"localforage": "^1.9.0",
"localforage-webextensionstorage-driver": "^2.0.0",
Expand Down