# Problems understanding and implementing Persistent Storage

**URL:** <https://discourse.nodered.org/t/problems-understanding-and-implementing-persistent-storage/80527>\
**Category:** General\
**Created:** [13 August 2023 01:09 UTC](https://discourse.nodered.org/t/problems-understanding-and-implementing-persistent-storage/80527 "2023-08-13T01:09:07Z")\
**Posts on this page:** 1\
**Showing post:** 18

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [13 August 2023 13:51 UTC](https://discourse.nodered.org/t/problems-understanding-and-implementing-persistent-storage/80527/18 "2023-08-13T13:51:41Z")

</div>

Also, since JavaScript passes objects by reference, if something "clears" that object out before the write occurs, it will write the changed value - depending on the life cycle of the variable, that may well be an empty object.

The test to make is - write something you know can never be externally affected e.g...

Function 1

```auto
const testObject= {
   prop1: 123
   prop2: "check me"
}
global.set('test_value', testObject) 

```

then reboot and test it...

Function 2

```auto
const testObject = global.get('test_value') 
node.warn([ 'What do you see', testObject)

```

Additionally, as said earlier, you should set the flush time to something sensible (e.g. 30 secs). Flush only occurs when there is something to write. I.e., never change a value, never write to global.

---

_[View the full topic](https://discourse.nodered.org/t/problems-understanding-and-implementing-persistent-storage/80527)._
