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

Asked

Viewed 108 times

2

I know that in Laravel 4 we can configure various ways to save session data. These are optional session storage mechanisms.

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

But there is also an option there called array.

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

I mean, I totally understand the kind of operation that will be performed in the other options, but this did not give to understand.

2 answers

3

"array - Sessions will be stored in a simple PHP array and will not be persisted Across requests." - Taken from the Laravel documentation site (http://laravel.com/docs/4.2/session)

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

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 persist between requests. That is, Session will not be saved and will be lost in the next request.

But what would I use it for?

This is a practice to be used in automated testing, so external services do not need to be ordered or access the disk when testing a stretch that uses Session, increasing the speed of testing.

Other common drivers for other settings when running tests are:

  • Queue:
  • cache: array
  • database: sqlite

Browser other questions tagged

You are not signed in. Login or sign up in order to post.