What is the "array" option in app / config / session.php?

2

I know that in Laravel 4 we can configure several ways to save session data. They are the optional storage mechanisms of session.

Among them, we can select memcached , database , cookie , apc and file , which by the way are very common.

However there is also an option called array .

If you select this option array , what will Laravel 4 do internally to save session data?

I mean, I fully understand the type of operation that will be performed on the other options, but that did not help.

    
asked by anonymous 12.08.2015 / 16:15

2 answers

1

As part of documentation :

  

array - sessions will be stored in a simple PHP array and will not be persisted across requests.

This driver will store the session in a simple array, and will not be persisted between requests. That is, the session will not be saved and will be lost on the next request.

But what would I use this for?

This is a practice to be used in automated testing, so external services do not need to be requested or access the disk by testing a session-using stretch, increasing the speed of testing.

Other common drivers for other configurations when running tests are:

  • queue: null
  • cache: array
  • database: sqlite
13.08.2015 / 19:58
3

"array - sessions will be stored in a simple PHP array and will not be persisted across requests." - Retrieved from the Laravel documentation site ( link )

In a free translation: "Array - sessions will be stored in a simple PHP array and will not be persistent between requests."

    
13.08.2015 / 19:52