Home > database >  Larave Cache Facade - set vs put
Larave Cache Facade - set vs put

Time:04-01

I use Cache::set(...) facade-method for a simple key/value store.

But all posts I visit seem to talk about Cache::put(...) method.

What is the difference or advantage of one vs the other?

CodePudding user response:

set method is same as put

As you can see from https://github.com/illuminate/cache/blob/master/Repository.php#L227 - set method delegates all work to put method.

set method is added only for compatibility with PSR-16 standard.

  • Related