mateusmaso/hipbone

Smart cache expiration

mateusmaso opened this issue · 1 comments

To always stay fresh with data and give user a good experience while navigating we could think of some solutions like russian doll and background fetch.

Now there is a method unsync inside models and collections for that purpose. You can call if there is any expiration after a certain flow and then listen to the unsync event.

class App.ItemView extends Skull.View

  initialize: (options={}) ->
    @item = options.item
    @listenTo(@item, "unsync", @populate)

  synced: ->
    @item.synced

  fetch: ->
    @item.fetch()

You can just expire whenever you want to

item.unsync()