Keep data between requests, no database required
Documentation
You wrote a backend script that needed to remember one thing between requests. A rotating token. A visit counter. A "last synced" cursor. The only honest options were an external database or a fragile hack, so the script stayed dumber than it needed to be.
The enemy is standing up a whole database table to hold a single number.
Backend scripts now get storage.*, a durable key-value store scoped to your brand. Values are JSON, so strings, numbers, booleans, arrays, and objects all round-trip. They survive restarts and every runtime server sees them instantly.
// count every visit, durably
var views = storage.increment('home_views');
// cache an OAuth token until it expires
storage.set('crm_token', token, { ttl: 3600 });
var token = storage.get('crm_token');
// let only one request refresh at a time
if (storage.setIfAbsent('refresh_lock', 1, { ttl: 30 })) {
refreshFeed();
}The full set: get, set, del, has, setIfAbsent, compareAndSet, increment, and an atomic mutate. Pass { namespace, ttl } to group keys or expire them. Reach for cache.* when a value can vanish. Reach for storage.* when it has to still be there tomorrow.
Try it: drop storage.increment('test') into a page backend script, reload three times, then print storage.get('test').