Skip to content

Commit

Permalink
Merge pull request #11 from YousefED/patch-1
Browse files Browse the repository at this point in the history
fix WP Transient expiration time
  • Loading branch information
markjaquith committed Dec 20, 2012
2 parents f2b88b5 + 6db5631 commit ea98042
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tlc-transients.php
Expand Up @@ -94,9 +94,10 @@ public function fetch_and_cache() {

public function set( $data ) {
// We set the timeout as part of the transient data.
// The actual transient has no TTL. This allows for soft expiration.
// The actual transient has a far-future TTL. This allows for soft expiration.
$expiration = ( $this->expiration > 0 ) ? time() + $this->expiration : 0;
set_transient( 'tlc__' . $this->key, array( $expiration, $data ) );
$transient_expiration = ( $this->expiration > 0 ) ? $this->expiration + 31536000 : 0; // 31536000 = 60*60*24*365 ~= one year
set_transient( 'tlc__' . $this->key, array( $expiration, $data ), $transient_expiration );
return $this;
}

Expand Down

0 comments on commit ea98042

Please sign in to comment.