[Zope] how to invalidate an object in the cache?
Marco Mariani
m.mariani@imola.nettuno.it
Sun, 2 Jul 2000 11:40:47 +0200
On Sun, Jul 02, 2000 at 03:56:39PM +1000, Marc Boschma wrote:
> Sounds like you need to manipulate the expiry time for the objects. I'd
> suggest that that can either be done in the RESPONSE or via meta tags in the
> standard_html_header to mark the page and the image as non-cacheable.
>
> I'm actually interested in a Guru's response on this as I will need to set
> the expiry explicitly to save load on the server for content that is
> dynamically generated but doesn't change often.
It would work, but I'd have to set up meta tags for LocalFS objects..
I've found a better kludge: when I call the index page, I pass a "refresh" variable along
the URL which contains the number of the modified image.
Within the index method, I then call:
<dtml-call "REQUEST.set('id2',id+'_0.jpg')">
<dtml-let img="store[id][id2]">
<A HREF="imageForm?fnum=&dtml.url_quote-id;"><IMG
SRC="<dtml-var "img.absolute_url()+['','?%s'%_.random.random()][REQUEST.get('refresh')==id]">"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
WIDTH="<dtml-var "img.width">"
HEIGHT="<dtml-var "img.height">"
ALT="&dtml-id;"></A>
</dtml-let>
This way, the refreshed image is called with a trailing "?0.283759872" that tricks Netscape
to think it's a new object, and reloads.
This could work for you too, maybe.
--
"This company has performed an illegal operation and will be shut down.
If the problem persists, contact your vendor or appeal to a higher court."
- Signal11 on slashdot