# Information on memory/buffer

**URL:** <https://discourse.nodered.org/t/information-on-memory-buffer/80865>\
**Category:** General\
**Created:** [28 August 2023 15:21 UTC](https://discourse.nodered.org/t/information-on-memory-buffer/80865 "2023-08-28T15:21:28Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![Luca91](https://avatars.discourse-cdn.com/v4/letter/l/3da27b/32.png) [@Luca91](https://discourse.nodered.org/u/Luca91)\
**Post date:** [7 September 2023 10:20 UTC](https://discourse.nodered.org/t/information-on-memory-buffer/80865/23 "2023-09-07T10:20:55Z")

</div>

I'm following this path because I need to save other variables, and I've noticed that Node-RED restarts if I perform high-frequency polling. So, my idea is to save only the average of the variables every 15 minutes and store everything in a file.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [7 September 2023 15:47 UTC](https://discourse.nodered.org/t/information-on-memory-buffer/80865/24 "2023-09-07T15:47:06Z")

</div>

> [@Luca91](#):
>
> Of course, if I use memoryOnly, it creates the array and updates it, if I use file, it replaces it with the last received message.

There should be absolutely no difference between using memory or File store. Provided _all_ uses of `json-spooler` use the same store. If there is then you have found a bug, but I will be surprised if that is the case. I am often surprised of course.

---

<div class="post-metadata">

**Author:** ![Luca91](https://avatars.discourse-cdn.com/v4/letter/l/3da27b/32.png) [@Luca91](https://discourse.nodered.org/u/Luca91)\
**Post date:** [8 September 2023 12:01 UTC](https://discourse.nodered.org/t/information-on-memory-buffer/80865/25 "2023-09-08T12:01:25Z")

</div>

I also thought the same thing, could you try and tell me what happens?  
I have set 'memoryOnly' as the default.

```auto
[
    {
        "id": "d37250881c41a530",
        "type": "change",
        "z": "d7f10d595c72d8fa",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "json_spooler",
                "pt": "flow",
                "to": "[$flowContext('json_spooler') , msg.json_spooler]\t",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 700,
        "y": 680,
        "wires": [
            []
        ]
    },
    {
        "id": "cb9710e6324880e9",
        "type": "inject",
        "z": "d7f10d595c72d8fa",
        "name": "",
        "props": [
            {
                "p": "json_spooler",
                "v": "test",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 470,
        "y": 680,
        "wires": [
            [
                "d37250881c41a530"
            ]
        ]
    }
]

```

The problem is that the array always looks for the 'memoryOnly' variable.

Please check if you can solve this short flow.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [8 September 2023 12:59 UTC](https://discourse.nodered.org/t/information-on-memory-buffer/80865/26 "2023-09-08T12:59:31Z")

</div>

If i understand correctly `$flowContext(string[, string])` takes a second optional argumnet, the store, just like the JS flow.get().

---

<div class="post-metadata">

**Author:** ![Luca91](https://avatars.discourse-cdn.com/v4/letter/l/3da27b/32.png) [@Luca91](https://discourse.nodered.org/u/Luca91)\
**Post date:** [13 September 2023 13:51 UTC](https://discourse.nodered.org/t/information-on-memory-buffer/80865/27 "2023-09-13T13:51:59Z")

</div>

I can't, in the end I'll settle for the change node

[Previous page](https://discourse.nodered.org/t/information-on-memory-buffer/80865.md?page=1)
