synchronize cache data using elegant syntax!
composer require mvaliolahi/cache-sync
$cacheSync = new CacheSync(ArrayDriver::class);
- note: ArrayDriver can be replaced with any implementation of 'Mvaliolahi\CacheSync\Contracts\CacheSyncDriver'.
$data = [
'name' => 'Meysam Valiolahi',
'email' => 'mvaliolahi@gmail.com',
];
$updatedData = $this->cacheSync
->data($data)
->change('name', 'Sohrab Valiolahi')
->change('email', 'sohrab_valiolahi@gmail.com')
->get()
$data = [
'data' => [
'houses' => [
[
'id' => 101,
'location' => 'Dubai'
],
[
'id' => 102,
'location' => 'Germany'
]
]
]
];
$this->cacheSync
->data($data)
->change('data.houses@id=101', [
'location' => 'Iran'
])
->get()
$cacheSync->persistTo('users:user.1');