NetTalk Central

Author Topic: Conditional NO-CACHE option fro dynamic or static pages  (Read 3272 times)

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 472
    • View Profile
    • Email
Conditional NO-CACHE option fro dynamic or static pages
« on: March 02, 2011, 01:09:56 AM »
Hallo,


I want for some dynamic pages to have the option NO-CACHE on. How can I do this? If I set in ProcessLink self.ForceNoCache = 1 then all site is NO-CACHE. And this is not good will run very slowly.... I would like just some pages. How can I do this?

My problem is that I have a browse where customers have photos. If the customer change an existing photo it will not refresh and show the current one. They need to CTRL+F5 or worst close and open again the browser or they need to go and delete manual the cache...
I want to avoid this by NO-CACHE option ...

Thank you for any suggestions

Robert

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Conditional NO-CACHE option fro dynamic or static pages
« Reply #1 on: March 02, 2011, 10:22:00 PM »
All dynamic pages have noCache on by default.

But you're not talking about dynamic pages, you're talking about images, which I suspect you're storing on the disk. These are static files, not dynamic ones.

If you wish to make some static files no-cache, then you need to set self.ForceNoCache, but on a selective basis. ie test the self.RequestFileName property first. In order not to clash with the static images, which are in the images folder, I recommend putting dynamic images in some other folder, and testing for that folder name in the request.

Bear in mind that when you include an image in a browse, all the browse generates is the <img> tag. The browser then fetches the image as a separate request, and hence on a separate thread, so this code goes in the WebHandler, not in the browse.

Cheers
Bruce

Robert Iliuta

  • Sr. Member
  • ****
  • Posts: 472
    • View Profile
    • Email
Re: Conditional NO-CACHE option fro dynamic or static pages
« Reply #2 on: March 03, 2011, 12:26:41 AM »
Hallo Bruce,

My images are stored in web\poze\ folder.
I test like this:

! WebHandler \ ProcessLink \ before parent

IF INSTRING('\poze\',clip(self.RequestFileName),1,1)
    self.ForceNoCache = 1
END

also I put the name of the form and browse with NO-CACHE and it works 99% :-) . In Chrome it works perfect. In Safari and Firefox i need to call again the browse than it's ok. Can I refresh some how the browse? and not from menu?

Thank you very much for help,

Robert