alloc/saus

Ability to disable caching of a state module in SSR

aleclarson opened this issue · 2 comments

You might prefer to hit the database every time a page is rendered that depends on a given state module.

In v0.5, you can use TimeToLive to achieve this.

import { defineStateModule, TimeToLive } from 'saus/client'

defineStateModule("foo", async function() {
  TimeToLive.set(this.cacheKey, 0)
})

I've added a shorthand property for this

import { defineStateModule } from 'saus/client'

defineStateModule("foo", async function() {
  this.maxAge = 0
})