Middle — Senior
Multilevel Data Caching
livecode
Task condition
It is necessary to build a caching mechanism that sequentially searches for the required information: first in the local cache variable, then in Redis, and only if the data is absent, it contacts the source provider. When the result is obtained, it should be written simultaneously to Redis and the local cache.
class DataProvider {
public function getData(array $arguments): array
{
// ...
}
}
$dataProvider = new DataProvider();
$data = $dataProvider->getData();