Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

How view cache actually works?


If we take example of album-o-rama application, in index action of the controller, the following code is used to generate key for caching

$offset = mt_rand(0, 1000);

$key = 'index'.$offset;

I m curious each time the application is refreshed won't it create the different cache file with name "index212, index765,...and so on". So I m wondering what is the point of cache if its creating different cache file everytime page is reloaded.

Please bear with me, I m a beginner.



I believe that part of the code is more to be shown as an example - If you check here

it is used for basically 'randomly' selecting a albums based on the PK being higher than $offet * 30 - up to 1000 possible cache varients that will last for 1 day