title: How to cache data in next.js server on vercel?
body: <p>I'm trying to build a small site that gets its data from a database (currently I use Firebase's Cloud Firestore).</p>
  <p>I've build it using next.js and thought to host it on vercel. It looks very nice and was working well.</p>
  <p>However, the site needs to handle ~1000 small documents - serve, search, and rarely update. In order to reduce calls to the database on every request, which is costly both in time, and in database pricing, I thought it would be better if the server could get the full list of item when it starts (or on the first request), and then hold them in memory and make data request get the data from its memory.</p>
  <p>It worked well in the local dev server, but when I deployed it to <code>vercel</code>, it didn't work. It seems <a href="https://github.com/vercel/next.js/issues/9397#issuecomment-555307503" rel="nofollow noreferrer">it forces me to work in serverless mode</a>, where each request is separate, and I can't use a common in-memory cache to get the data.</p>
  <p>Am I missing something and there is a way to achieve something like that with <code>next.js</code> on <code>vercel</code>?</p>
  <p>If not, can you recommend other free cloud services that can provide what I'm looking for?</p>