I am using cache to store data structure from database:
Cache::forever(static::DATA_STRUCTURE, json_encode($tree));
However before I generate there should cleaned old:
Artisan::call('cache:clear');
But generating new cache takes some time and I want to store old cache until new will be generated.
I am using typical file cache. Does anyone can provide some hint? Maybe we can do it from the box or some package.
At this moment I see only one solution: just generate in some other folder and remove old folder with cache, then move new instead the old.
I solved my problem when I pushed data in variables, cleaned the cache by tag, then pushed new data to this tag.