![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| ||||
| ||||
|
|
Mark Tranchant wrote: I've just migrated my site content from normal files to a MySQL database. Performance is excellent Loading is not noticeably more than with static files. Perhaps, on first load. But on reload, I must wait for the file to be regenerated. This is not terribly slow, but it seems rather unnecessary for your content. |
|
No last-modified header, thus there's no chance for a 304 response, even where the document has not been modified. |
|
May I ask why, in addition to skipping last-modified header, you have chosen to include cache-control: no-cache? Is this to make your content-type picker work through the proxy? |
|
Not site-wide, no. But I have created individual php pages that rely on a MySQL db. For them, I wrote a php script to query the db for a last-modified date, and modified a php script to process if-modified-since and if-none-match headers and send a 304 as appropriate. |
#3
| ||||
| ||||
|
|
Mark Tranchant wrote: I've just migrated my site content from normal files to a MySQL database. Performance is excellent Loading is not noticeably more than with static files. Perhaps, on first load. But on reload, I must wait for the file to be regenerated. This is not terribly slow, but it seems rather unnecessary for your content. |
| http://tranchant.plus.com/ No last-modified header, thus there's no chance for a 304 response, even where the document has not been modified. |
|
Questions? May I ask why, in addition to skipping last-modified header, you have chosen to include cache-control: no-cache? Is this to make your content-type picker work through the proxy? |
|
Advice from anyone who's already done this? Not site-wide, no. But I have created individual php pages that rely on a MySQL db. For them, I wrote a php script to query the db for a last-modified date, and modified a php script to process if-modified-since and if-none-match headers and send a 304 as appropriate. |
#4
| |||
| |||
|
|
There used to be an ETag header. I wonder what's happened to that. Well, with static pages on Apache, ETag is automatic. If you go with a db/php implementatino, you'll have to create an ETag through the script. Same for Last-Modified: you'll have to determine that and create the header. |
|
May I ask why, in addition to skipping last-modified header, you have chosen to include cache-control: no-cache? Is this to make your content-type picker work through the proxy? Yes, although note that "skipping" the last-modified header isn't through choice. Ok, I'm curious. What does this mean? Did someone threaten you? ("Listen mate: You keep sendin' a Last-Modified header, and my boys here'll break yur caps-lock key -- in the down position!") :-) |
|
Again, is this related to the application/xml v. text/html switcher thingy you have created? And is that why you have cache-control: no-cache set? |
#5
| ||||
| ||||
|
|
Err, your welcome. (What pointer? I didn't have a chance to show you the code I wrote to do it. And by the way, how in the HELL did you get your conditional GET up and running so quickly?! It took me days to implement it here. <sob> If there was any doubt -- I suppose there should not have been -- we now know who the better coder is!) |
|
I use a TIMESTAMP column in the database that automatically updates whenever I edit the content. I assume this is the timestamp for the table as a whole, right? Or did you create a timestamp for individual records? If the latter, and it is updated automatically, then my curiousity is perked. |
|
I now issue a timestamp-related ETag for each page, as well as a Last-Modified header. I use any incoming If-Modified-Since headers to compare against the last modified date and send either 304 or 200+content as appropriate. I haven't done anything with If-None-Match yet - I need to look into that a bit more. Here's what I started with for my conditional GET: http://simon.incutio.com/archive/200...conditionalGet I changed it a bit for the photography site, and added a function to get the last-modified from the MySQL table, but the basic if-modified-since and if-none-match stuff I more or less took from that blog entry. |
|
Incidentally, I wanted to post my code on the web somewhere, so that others might use it to provide cache-friendly php/MySQL sites. Alas, I have to permanent home for such a thing. Perhaps you'll put something up on your site? |
#6
| |||
| |||
|
|
I hate to be a fly in the ointment, but it seems like the cost of the xhtml/html switcher is rather high for the small benefit you receive. From where I sit, you'd be better off going with HTML only. You could always leave a demo page up to demonstrate your programming prowess on this project. (It really is a neat implementation!) |
#7
| |||
| |||
|
|
Mark Tranchant wrote: $line["lm"] is the timestamp from the database (see below): $lm = $line["lm"]; $year = substr($lm,0,4); $month = substr($lm,4,2); $date = substr($lm,6,2); $hour = substr($lm,8,2); $min = substr($lm,10,2); $sec = substr($lm,12,2); $lmts = mktime($hour,$min,$sec,$month,$date,$year); I think there's an easier way to get this. Sadly, my local copy is on |
#8
| |||
| |||
|
|
that os component, as A. Flavell has dubbed it. |
![]() |
| Thread Tools | |
| Display Modes | |
| |