Junior — Senior
Implementing report result caching
livecode
Task condition
The existing code implements report generation according to the specified requirements. It is necessary to add caching for the generated report with a duration of 10 minutes, using the cache interface from the PSR-16 standard (https://www.php-fig.org/psr/psr-16/#21-cacheinterface).
namespace MyApplication;
final readonly class ReportSpecification
{
// some properties defining the report content
}
final readonly class Report
{
// some properties with report data
}
interface Analyst
{
public function generateReport(ReportSpecification $criteria): Report;
}
final class PostgresAnalyst implements Analyst
{
public function generateReport(ReportSpecification $criteria): Report
{
// heavy queries with joins and aggregations
return new Report(/* report data */);
}
}