Netflix / falcor

A JavaScript library for efficient data fetching

Home Page:http://netflix.github.io/falcor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Expiring a ref?

emilgoldsmith opened this issue · comments

Would it be possible to add an expiry to refs? From the docs it looks like it doesn't exist at the moment.

The reason I'd like it is for example for the newspaper website I'm writing we have a trending bar, and if I'd like that to update every minute or so, it would be awesome if I could expire the refs so falcor would automatically refresh the data.

@emilgoldsmith You should be able to return the ref with $expires metadata set to a negative value (negative to indicate the time should be relative to when the ref is inserted into the cache) like so: { $type: 'ref', value: ['some', 'path'], $expires: 60 * 1000 * -1 }. You'll still need to do a get call for the data you want every minute or so, falcor doesn't re-fetch expired data automatically.

Okay cool, I'll try that.

You might want to make it clear that that's a possibility in the docs though. Of course unless I missed something