Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set cache-control headers for caching #10

Open
paulgibbs opened this issue Nov 19, 2013 · 4 comments
Open

Set cache-control headers for caching #10

paulgibbs opened this issue Nov 19, 2013 · 4 comments

Comments

@paulgibbs
Copy link
Contributor

No description provided.

@natebot
Copy link
Contributor

natebot commented Dec 29, 2013

Are you thinking just setting the max-age, or do you wish to support the Prama and Expires headers too?
Could we just make the cache time filterable? Something like:

$cache_time = do_filter( 'wpcom_vip_ad_busters_cache_time', false );
if( false !== $cache_time )
     header( 'Cache-Control: max-age='. int( $cache_time )   );

@paulgibbs
Copy link
Contributor Author

We should always set a cache expiration time, but i'm always happy to add filters or actions. I don't have a preference for the default cache time, so whatever seems sensible to you. :)

Let's go for both Cache-Control and Expires. I understand Expires was for HTTP 1.0 and Cache-Control is (better) and for HTTP 1.1. ?

@mjangda
Copy link
Member

mjangda commented Dec 29, 2013

I don't think a filter is all that helpful here. Is there a particular use
case where you'd want a different cache time (considering that the files
don't really change that often)?
On Dec 28, 2013 8:31 PM, "Nathan Letsinger" [email protected]
wrote:

Are you thinking just setting the max-age, or do you wish to support the
Prama and Expires headers too?
Could we just make the cache time filterable? Something like:

$cache_time = do_filter( 'wpcom_vip_ad_busters_cache_time', false );if( false !== $cache_time )
header( 'Cache-Control: max-age='. int( $cache_time ) );


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

@natebot
Copy link
Contributor

natebot commented Dec 30, 2013

I can't think of a reason for filtering, since, as you say, the files do not change that often.
So maybe a 1-day cache time? I suppose it could be longer ( 30 days? ) but that means any new changes don't go into effect for previous visitors...

$age =  60*60*24*1;
header( 'Cache-Control: max-age=' . $age  );
header( 'Expires: ' . gmdate( "D, d M Y H:i:s", time() + $age ) . ' GMT' );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants