# MQTT5 retained message

**URL:** <https://discourse.nodered.org/t/mqtt5-retained-message/83494>\
**Category:** General\
**Tags:** mqtt\
**Created:** [7 December 2023 11:28 UTC](https://discourse.nodered.org/t/mqtt5-retained-message/83494 "2023-12-07T11:28:03Z")\
**Posts on this page:** 1\
**Showing post:** 15

<div class="post-metadata">

**Author:** ![Lupin\_III](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lupin_iii/32/67650_2.png) [@Lupin\_III](https://discourse.nodered.org/u/Lupin_III)\
**Post date:** [7 December 2023 17:09 UTC](https://discourse.nodered.org/t/mqtt5-retained-message/83494/15 "2023-12-07T17:09:45Z")

</div>

Thanks. So just to be sure I'll recap it:

- this writes immediatly on disk

```auto
file: {
      module: 'localfilesystem',
      config: {
            cache: false
      },
}

```

and in a function node:  
context.set("mqttID", msg.payload.timestamp), "file", function(err){if(err){node.error(err, msg)}});

- While this one writes on disk each second

```auto
file: {
      module: 'localfilesystem',
      config: {
            cache: true,
            flushInterval: '1'
      },
}

```

and in a function node, as above,  
context.set("mqttID", msg.payload.timestamp), "file", function(err){if(err){node.error(err, msg)}});

---

_[View the full topic](https://discourse.nodered.org/t/mqtt5-retained-message/83494)._
