title: Serialize instance of object via memory dump
body: <p>Is it possible to dump an in-memory object and then close the node process then load it back in? I am thinking about a memoization function that is cached between processes.</p>
  
  <p>I would love to be able to <code>memoize</code> a cache between processes.</p>
  
  <p>The issue is that no memoization library serializes instances of objects.</p>
  
  <p>I was playing around with this library <a href="https://github.com/borisdiakur/memoize-fs" rel="nofollow noreferrer">memoize-fs</a></p>
  
  <pre><code>async function fun(a) {
    return new Hello(a);
  }
  
  async function fun_(a) {
    return memoize.fn(fun, {}).then((memFn) =&gt; {
      return memFn(a);
    });
  }
  
  fun('meow').then(console.log);
  fun_('meow').then(console.log);
  
  </code></pre>
  
  <p>First time this runs:</p>
  
  <pre><code>Hello { sound: 'meow' }
  Hello { sound: 'meow' }
  </code></pre>
  
  <p>Second time this runs:</p>
  
  <pre><code>Hello { sound: 'meow' }
  { sound: 'meow' }
  </code></pre>