You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been experimenting with this library, and had really positive expierences the past few days.
The application I am working with has to fetch a lot of data from an API, where a request takes about 1 minute to complete. To enhance user experience, I introduced caching. On that specific request, a one day cache expiry is totally acceptable, so I set it up:
public function cacheExpiryInSeconds(): int
{
return 86400; // One day
}
However, since the request takes so long, I would like to introduce an hourly automatic cache update in the background using Laravel Scheduler. Here I would like to reuse the connector and the request that I have already defined:
Schedule::call(function () {
$connector= new XYZConnector();
$request = new TestRequest();
$response = $connector->send($request);
})->hourlyAt('15');
Here comes my problem. This hourly job update will not update the cache because of the cacheExpiryInSeconds defined in the Request. However, I can't change that, because I want my users who are doing the request from the frontend to be able to used the cache version of the response for one day. :)
Should I change my approach here? Or is a 'cache force update' something that can be a great feature? With that, I would be able to forcefully overwrite the cache in my hourly job. Right now I don't see any other option just to stick to Laravel's manual Cache store.
The text was updated successfully, but these errors were encountered:
Hello everyone!
I have been experimenting with this library, and had really positive expierences the past few days.
The application I am working with has to fetch a lot of data from an API, where a request takes about 1 minute to complete. To enhance user experience, I introduced caching. On that specific request, a one day cache expiry is totally acceptable, so I set it up:
However, since the request takes so long, I would like to introduce an hourly automatic cache update in the background using Laravel Scheduler. Here I would like to reuse the connector and the request that I have already defined:
Here comes my problem. This hourly job update will not update the cache because of the cacheExpiryInSeconds defined in the Request. However, I can't change that, because I want my users who are doing the request from the frontend to be able to used the cache version of the response for one day. :)
Should I change my approach here? Or is a 'cache force update' something that can be a great feature? With that, I would be able to forcefully overwrite the cache in my hourly job. Right now I don't see any other option just to stick to Laravel's manual Cache store.
The text was updated successfully, but these errors were encountered: