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

Feature request: user settings for expiration times #82

Open
bartv42 opened this issue Feb 23, 2017 · 6 comments
Open

Feature request: user settings for expiration times #82

bartv42 opened this issue Feb 23, 2017 · 6 comments

Comments

@bartv42
Copy link

bartv42 commented Feb 23, 2017

Hi,

I've manually updated the mashsb_get_expiration_method_async function to add another expiration tier and to increase the expiration times. On a high-traffic site, this helps me update only the posts that are relevant to my readers. It would be great if we could set both the thresholds and expiration times from within the plugin settings screen!

function mashsb_get_expiration_method_async() {
// post age in seconds
$post_age = floor( date( 'U' ) - get_post_time( 'U', true ) );

if( isset( $post_age ) && $post_age > 365*24*3600 ) {
	$seconds = 30 * 24 * 3600;
} else if( isset( $post_age ) && $post_age > 60*24*3600 ) {
	$seconds = 7 * 24 * 3600;
} else if( isset( $post_age ) && $post_age > 3*24*3600 ) {
	$seconds = 1 * 24 * 3600;
} else {
    // expire cache after one hour
    $seconds = 3600;
}

return $seconds;

}

@rene-hermenau
Copy link
Contributor

I created three filters: https://github.com/mashshare/MashShare/blob/3.3.9/includes/sharecount-functions.php#L158

Does this work for you?

@bartv42
Copy link
Author

bartv42 commented Feb 23, 2017 via email

@rene-hermenau
Copy link
Contributor

Ok, check again latest git. Created two more filters for you

@rene-hermenau
Copy link
Contributor

Please do me a favour and test it for me:)

@bartv42
Copy link
Author

bartv42 commented Feb 23, 2017 via email

@rene-hermenau
Copy link
Contributor

👍

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

2 participants