Skip to content
Advertisement

Larave Cache Facade – set vs put

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?

Advertisement

Answer

set method is same as put

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

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

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement