mercredi 12 octobre 2016

Laravel Cache. Increment or Put if value does not exist

Is is possible to replace this line of code with something out of the box.

Cache::has('test') ? \Cache::increment('test') : \Cache::put('test', 1, 60);

So basically, I need to check if test exists in the cache. If yes then increment the value, if not create cache record and set value 1.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire