{
    "version": "https:\/\/jsonfeed.org\/version\/1",
    "title": "SOREX.ORG: заметки с тегом node red",
    "_rss_description": "Exchange, esx, AD, GPO, veeam, adaptec,lsi megaraid",
    "_rss_language": "ru",
    "_itunes_email": "",
    "_itunes_categories_xml": "",
    "_itunes_image": "",
    "_itunes_explicit": "",
    "home_page_url": "https:\/\/sorex.org\/?go=tags\/node-red\/",
    "feed_url": "https:\/\/sorex.org\/?go=tags%2Fnode-red%2Fjson%2F",
    "icon": "https:\/\/sorex.org\/user\/userpic@2x.jpg?1618299116",
    "author": {
        "name": "sorex",
        "url": "https:\/\/sorex.org\/",
        "avatar": "https:\/\/sorex.org\/user\/userpic@2x.jpg?1618299116"
    },
    "items": [
        {
            "id": "9",
            "url": "https:\/\/sorex.org\/?go=all\/node-red-sohranenie-dannyh\/",
            "title": "Node red сохранение данных",
            "content_html": "<!-- wp:paragraph --><p>Prior to Node-RED v0.19.0, data could be stored in context as a global, flow or node. This was stored in memory and would be reset with a restart of Node-RED. As of v.0.19.0 you can now store node, flow and global context data in memory OR in a file which will persist over restarts. (the data will be stored in the userDir, which is normally $HOME\/.node-red, in a folder ’context’ with subfolders for each flow or node and one folder for all globals.)<\/p>\n<!-- \/wp:paragraph --><!-- wp:paragraph --><p>In order to store the data, you must make a change to <pre class=\"e2-text-code\"><code class=\"\">settings.js<\/code><\/pre> — without the change, context stores will always be in memory and will not be persistent.<\/p>\n<!-- \/wp:paragraph --><!-- wp:paragraph --><p>The contextStorage property in settings.js is used to configure how context data is stored:<\/p>\n<!-- \/wp:paragraph --><!-- wp:code --><pre class=\"wp-block-code\"><pre class=\"e2-text-code\"><code class=\"\">contextStorage: {\r\n    \tstoreName    : { module: &quot;storeModule&quot; }\r\n    },<\/code><\/pre><\/pre>\n<!-- \/wp:code --><!-- wp:paragraph --><p><pre class=\"e2-text-code\"><code class=\"\">storeName<\/code><\/pre>: The storeName used in get\/sets<br><br><pre class=\"e2-text-code\"><code class=\"\">storeModule<\/code><\/pre><p>: Node-RED provides two built-in store modules: <\/p>\n<pre class=\"e2-text-code\"><code class=\"\">memory<\/code><\/pre><p> and <\/p>\n<pre class=\"e2-text-code\"><code class=\"\">localfilesystem<\/code><\/pre><p>. It is also possible to create custom store plugins. You must specify localfilesystem (or your own custom module) to make the data persistent. For details on creating custom modules, see the api pages.<\/p><\/p>\n<!-- \/wp:paragraph --><!-- wp:paragraph --><p>If you only have one option in contextStorage, it will always be used. If you have two options and one has the storeName <pre class=\"e2-text-code\"><code class=\"\">default<\/code><\/pre> (order doesn’t matter) it will be used if the get\/set storeName option is not used. If you try to <pre class=\"e2-text-code\"><code class=\"\">get<\/code><\/pre> or <pre class=\"e2-text-code\"><code class=\"\">set<\/code><\/pre> using a location storeName that does not exist, it will use the default and you will see a one time warning in the log.<\/p>\n<!-- \/wp:paragraph --><!-- wp:paragraph --><p>Example: say these are your entries in setting.js:<\/p>\n<!-- \/wp:paragraph --><!-- wp:code --><pre class=\"wp-block-code\"><pre class=\"e2-text-code\"><code class=\"\">contextStorage: {\r\n\t\tstoreInFile: { module: &quot;localfilesystem&quot;},\r\n    \tdefault    : { module: &quot;memory&quot; }\r\n    },<\/code><\/pre><\/pre>\n<!-- \/wp:code --><!-- wp:paragraph --><p>And you use the following set’s (this applies to any node that can access context directly like the change, inject, or change nodes):<\/p>\n<!-- \/wp:paragraph --><!-- wp:code --><pre class=\"wp-block-code\"><pre class=\"e2-text-code\"><code class=\"\">flow.set(&quot;count&quot;, 123);               \/\/ stored in memory, count = 123\r\nflow.set(&quot;count&quot;, 234, &quot;default&quot;);    \/\/ stored in memory, count now - 234\r\nflow.set(&quot;partid&quot;, &quot;b301&quot;, &quot;storeInFile&quot;); \/\/ stored in file, partid = &quot;b301&quot;\r\nflow.set(&quot;color&quot;, &quot;red&quot;, &quot;InFile&quot;);   \/\/ invalid storeName \r\n                                      \/\/ - stored based on 'default' rules\r\n                                      \/\/ - a 'storeName' of `default` exists and is used\r\n                                      \/\/ - stored in memory, color = 'red'<\/code><\/pre><\/pre>\n<!-- \/wp:code --><!-- wp:paragraph --><p>Note: Having multiple entries in settings.js can lead to confusion. If you have:<\/p>\n<!-- \/wp:paragraph --><!-- wp:code --><pre class=\"wp-block-code\"><pre class=\"e2-text-code\"><code class=\"\">contextStorage: {\r\n    \tdefault    : { module: &quot;memory&quot; },\r\n\t\tstoreInFile: { module: &quot;localfilesystem&quot;},\r\n\t\tmemoryOnly : { module: &quot;memory&quot; }\r\n    },<\/code><\/pre><\/pre>\n<!-- \/wp:code --><!-- wp:paragraph --><p>and run the following code:<\/p>\n<!-- \/wp:paragraph --><!-- wp:code --><pre class=\"wp-block-code\"><pre class=\"e2-text-code\"><code class=\"\">flow.set(&quot;count&quot;, 123);               \/\/ the value is stored in memory\r\n\tflow.set(&quot;count&quot;, 234, &quot;default&quot;);    \/\/ the value is stored in memory\r\n\tflow.set(&quot;count&quot;, 345, &quot;memoryOnly&quot;); \/\/ the value is stored in memory<\/code><\/pre><\/pre>\n<!-- \/wp:code --><!-- wp:paragraph --><p>the first line stores ’123’ in default:count.<br>the second line replaces ’123’ with ’234’ in default:count<br>the third line stores ’345’ in memoryOnly:count<\/p>\n<!-- \/wp:paragraph --><!-- wp:paragraph --><p>If you forget to specify the location in a <pre class=\"e2-text-code\"><code class=\"\">get<\/code><\/pre> or <pre class=\"e2-text-code\"><code class=\"\">set<\/code><\/pre>, you might end up with the wrong value.<\/p>\n<!-- \/wp:paragraph --><!-- wp:paragraph --><p><strong>SUGGESTION:<\/strong> If you want have all your context data be persistant, setup your settings.js file with the following:<\/p>\n<!-- \/wp:paragraph --><!-- wp:code --><pre class=\"wp-block-code\"><pre class=\"e2-text-code\"><code class=\"\">contextStorage: {\r\n    \tdefault    : { module: &quot;localfilesystem&quot;}\r\n    },<\/code><\/pre><\/pre>\n<!-- \/wp:code -->",
            "date_published": "2021-04-13T09:28:17+00:00",
            "date_modified": "2021-04-13T09:28:10+00:00",
            "_date_published_rfc2822": "Tue, 13 Apr 2021 09:28:17 +0000",
            "_rss_guid_is_permalink": "false",
            "_rss_guid": "9",
            "_e2_data": {
                "is_favourite": false,
                "links_required": [
                    "system\/library\/highlight\/highlight.js",
                    "system\/library\/highlight\/highlight.css"
                ],
                "og_images": []
            }
        }
    ],
    "_e2_version": 3820,
    "_e2_ua_string": "E2 (v3820;)"
}