caching gists

32 views
Skip to first unread message

Geoffery Miller

unread,
Apr 4, 2014, 4:51:48 PM4/4/14
to trib...@googlegroups.com
https://github.com/georules/tributary/tree/gistcache

This is just some mockup code to iterate.  There are still some console.log's scattered around and probably a few more bugs I haven't fixed.

It modifies ui.js to use the sandbox index.js getgist endpoint first, which then attempts to load data from a cache of the gist stored in mongo.  If it does not have the gist, it will store it for use in the future.

after_save in server.js is modified to invalidate the cache

There is no cache invalidation for saving a gist outside of tributary (if I modify the gist on github for example) -- thoughts about this?

Ian Johnson

unread,
Apr 5, 2014, 2:30:46 PM4/5/14
to Geoffery Miller, trib...@googlegroups.com
This looks awesome, I think I'll integrate it in a bit.
As for updating outside of tributary, its an uncommon use case which could be addressed with an obscure thing like adding an ?update=true endpoint which invalidates the cache and repopulates it.

thanks!


--
You received this message because you are subscribed to the Google Groups "Tributary" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tributary+...@googlegroups.com.
Visit this group at http://groups.google.com/group/tributary.
For more options, visit https://groups.google.com/d/optout.



--
Ian Johnson - 周彦

Geoffery Miller

unread,
Apr 5, 2014, 2:35:06 PM4/5/14
to trib...@googlegroups.com, Geoffery Miller
I was trying to think about how to use this to solve the offline problem too -- maybe another endpoint /inletoffline/ that will only use the local gistcache rather than going to github for a gist id?

Geo

Ian Johnson

unread,
Apr 5, 2014, 2:49:12 PM4/5/14
to Geoffery Miller, trib...@googlegroups.com
Yeah, send a pull request!

As for the offline cache, that would be great using localstorage.
It's just a matter of thinking through how saving would work when offline. maybe its just a matter of indicating to the user where things have been saved / would be saved?

Geoffery Miller

unread,
Apr 5, 2014, 3:29:37 PM4/5/14
to Ian Johnson, trib...@googlegroups.com
I think using localstorage as a backup in case your work isn't saved to github would be a good idea as well.  I'll keep expanding on what I've posted so far and send a pull request when I have a few more of these things.

Ian Johnson

unread,
Apr 5, 2014, 5:20:58 PM4/5/14
to Geoffery Miller, trib...@googlegroups.com
caching is live!!!

thanks man, been wanting this for a while...
Lets keep an eye out for any weird behavior, but the code looks solid to me.
Reply all
Reply to author
Forward
0 new messages