nbviewer icon indicating copy to clipboard operation
nbviewer copied to clipboard

How long does a cached notebook persist?

Open nicktimko opened this issue 11 years ago • 7 comments

I stumbled onto issue #219 on accident by having a loose <div> that totally shredded page layout. I quickly corrected it in my Gist, but the NBViewer seems to have cached the busted version and won't forget. Granted, I'm a bit impatient, but I sent out a link to the notebook to some collaborators and figure they might look at it in short order. A better developer would probably check their code before pushing it out...

Anyways, perhaps add another question (and answer) to the FAQ: Why isn't my notebook updating?

nicktimko avatar May 30 '14 01:05 nicktimko

normally, it will be cached for ten minutes, but it will be longer if it takes a long time to render.

minrk avatar May 30 '14 05:05 minrk

Is there a way to force NBViewer to update its cached render?

HamishBrownPFR avatar Dec 03 '14 19:12 HamishBrownPFR

From the code I would say append ?flush_cache=true ?

FAQ: Yep, PR welcomed.

Carreau avatar Dec 03 '14 19:12 Carreau

For me ?flush_cache=true shows the new variant, but when I remove it I still have the old version.

axil avatar Sep 27 '19 14:09 axil

For me ?flush_cache=true shows the new variant, but when I remove it I still have the old version.

Having this issue too.

moorepants avatar Feb 12 '20 23:02 moorepants

In my experience, it almost seems like ?flush_cache=false is necessary to actually flush the cache, and that ?flush_cache=true does the opposite (not flush the cache).

E.g. see here: https://github.com/krinsman/clonenotebooks/blob/master/templates/notebook.html#L33

In this extension to NBViewer, I need for the link to not use cache so that the query argument, which is handled differently by the Tornado server, to be treated.

Actually looking at the code, it looks like this is actually what happens (i.e. the cache is flushed only when flush_cache=false):

https://github.com/jupyter/nbviewer/blob/f93518c8252aec2c5c9bfcfd40bb70cbff7f0f77/nbviewer/providers/base.py#L528

krinsman avatar Feb 26 '20 21:02 krinsman

@axil @moorepants Could either of you clarify what you mean by "the new variant"?

I don't think I understand.

The first line of the code checks the rate limiter here:

https://github.com/jupyter/nbviewer/blob/f93518c8252aec2c5c9bfcfd40bb70cbff7f0f77/nbviewer/ratelimit.py#L30

And then as far as I can tell, there isn't necessarily any emptying of the cache, it's just that the method proceeds without checking for any cached version, which may have the same effect as removing the page from the cache.

krinsman avatar Feb 26 '20 21:02 krinsman