Add signup link cache expiration for 3 months

This commit is contained in:
dinamiko 2022-05-26 11:05:30 +02:00
parent f813cf451a
commit 0c5dfbc3e8
2 changed files with 4 additions and 3 deletions

View file

@ -67,10 +67,11 @@ class Cache {
*
* @param string $key The key under which the value should be cached.
* @param mixed $value The value to cache.
* @param int $expiration Time until expiration in seconds.
*
* @return bool
*/
public function set( string $key, $value ): bool {
return (bool) set_transient( $this->prefix . $key, $value );
public function set( string $key, $value, int $expiration = 0 ): bool {
return (bool) set_transient( $this->prefix . $key, $value, $expiration );
}
}

View file

@ -103,7 +103,7 @@ class OnboardingRenderer {
$url = $is_production ? $this->production_partner_referrals->signup_link( $data ) : $this->sandbox_partner_referrals->signup_link( $data );
$url = add_query_arg( $args, $url );
$this->cache->set( $environment . '-' . $product, $url );
$this->cache->set( $environment . '-' . $product, $url, 3 * MONTH_IN_SECONDS );
return $url;
}