I am trying to implement caching of related records, I have two classes, say:
<pre> Car { initialize() { hasMany(Tyre); } }
Tyre { initialize() { belongsTo(Car) } } </pre>
I created a custom cache (Data frontend, File storage) and added it to $di
Now to save related records to this cache, I wrote:
$car = Car::findFirst(); $t = $car->getTyre(); $car->tyre = $t;
// push to cache $cache->save('a-key', $car, 900);
The problem is that the cache only stores Car object. The nested related Tyres are not there
What I am trying to do is very similar to this article - https://docs.phalcon.io/en/latest/reference/models-cache.html#caching-related-records-recursively, except that I want to store related records in a custom cache (instead of modelsCache).
Any help would be great! thanks