progrium / viewdocs

Read the Docs meets Gist.io for simple Markdown project documentation

Home Page:http://viewdocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

changes to template.html not updated (stale cache problem?)

philipmjohnson opened this issue · comments

I made a change to my template.html file this morning (a change from a textual link to my github repo to the 'fork me on github' ribbon').

I was proudly showing off my viewdocs site to a student when I noticed that he retrieved a page showing the textual link, not the github ribbon.

This student had never retrieved the site before, so it wasn't because he had a local cache of the page.

After he manually refreshed the page, it displayed the ribbon.

I am guessing from this behavior that viewdocs somehow caches the rendered pages and does not invalidate the cache when a new template.html file is committed?

Which brings up another question I have been meaning to ask: how the heck does viewdocs actually work? Where are my rendered files being stored, for example? Who do I thank for paying for the storage/computational requirements for this service?

Whenever you view a page, if not cached, it looks up the content directly from the Github repo and passes it through a Markdown rendering API. In parallel, it will check to see if there was a template.html file. When both complete it will cache the rendered result in memory using an LRU strategy then return the rendered page. It will also expire rendered pages if they are fetched and are about a minute or two old, however, this invalidation happens in a way that will first return the existing rendered page. This means that the new page will only show up on the next viewing. The reason for this is just to simplify the code, and seemed like a reasonable tradeoff.

Feel free to browse the source, it's not that complicated. Is there an issue or should I close this?

So after two minutes, there is at most one "stale" page view? Sounds perfectly reasonable to me. Might be reasonable at some point to create a "rendering engine" documentation page where you explain the above approach so that newbies like myself understand that this is a design tradeoff, not a bug.

I'll make a note of it in docs for sure.

On Fri, Dec 13, 2013 at 12:41 PM, Philip Johnson
notifications@github.comwrote:

So after two minutes, there is at most one "stale" page view? Sounds
perfectly reasonable to me. Might be reasonable at some point to create a
"rendering engine" documentation page where you explain the above approach
so that newbies like myself understand that this is a design tradeoff, not
a bug.


Reply to this email directly or view it on GitHubhttps://github.com//issues/18#issuecomment-30541987
.

Jeff Lindsay
http://progrium.com