Use setEx to add expiry to customer discount cache.
Previously, the customer discount cache lacked an expiry time, which could lead to stale data. This change ensures the cached value expires after 60 seconds, improving cache reliability.
This commit is contained in:
+1
-1
@@ -151,7 +151,7 @@ class redis implements redis_i
|
||||
public function cache_economic_customer_discount_percentage(int $customer_number, int $discount_percentage): self
|
||||
{
|
||||
// Cache the economic customer discount percentage
|
||||
$this->set('economic_customer_discount_percentage_' . $customer_number, $discount_percentage);
|
||||
$this->setEx('economic_customer_discount_percentage_' . $customer_number, $discount_percentage, 60);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user