Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'doc/session-clarify'

  • Loading branch information...
commit 329d2e1e8c0ea268f82b2a86c89b45b29b84e129 2 parents 62dc598 + 66092aa
@xsawyerx xsawyerx authored
Showing with 19 additions and 20 deletions.
  1. +14 −20 lib/Dancer2/Manual.pod
  2. +5 −0 lib/Dancer2/Manual/Migration.pod
34 lib/Dancer2/Manual.pod
@@ -744,23 +744,16 @@ It's common to want to use sessions to give your web applications state; for
instance, allowing a user to log in, creating a session, and checking that
session on subsequent requests.
-To make use of sessions, you must first enable the session engine - pick the
-session engine you want to use, then declare it in your config file like
+By default Dancer 2 has L<Simple|Dancer2::Session::Simple> sessions enabled.
+It implements a very simple in-memory session storage. This will be fast and
+useful for testing, but such sessions will not persist between restarts of
+your app.
- session: Simple
+If you'd like to use a different session engine you must declare it in the
+configuration file.
-The L<Dancer2::Session::Simple> backend implements a very simple in-memory
-session storage. This will be fast and useful for testing, but such sessions
-will not persist between restarts of your app.
-B<Note:> The L<Dancer2::Session::Simple> backend is the default. If you do
-not enable sessions explicitly, it will be used implicitly.
-You can also use the L<Dancer2::Session::YAML> backend included with
-Dancer2, which stores session data on disc in YAML files (since YAML is a
-nice human-readable format, it makes inspecting the contents of sessions a
+For example to use YAML file base sessions you need to add the following
+to your F<config.yml>:
session: YAML
@@ -768,12 +761,13 @@ Or, to enable session support from within your code,
set session => 'YAML';
-However, controlling settings is best done from your config file.
+(However, controlling settings is best done from your config file.)
-'YAML' in the example is the session backend to use; this is shorthand for
-L<Dancer2::Session::YAML>. There are other session backends - for instance
-L<Dancer2::Session::Memcached> - but the YAML backend is simple and easy to
+The L<Dancer2::Session::YAML> backend implements a file-based YAML session
+storage to help with debugging, but shouldn't be used on production systems.
+There are other session backends, such as L<Dancer2::Session::Memcached>,
+which are recommended for production use.
You can then use the L<session|Dancer2/session> keyword to manipulate the
5 lib/Dancer2/Manual/Migration.pod
@@ -289,6 +289,11 @@ function with decoded input.
You no longer need to implement the C<loaded> method. It is simply
+=head3 Sessions
+Now the L<Simple|Dancer2::Session::Simple> session engine is turned on
+by default, unless you specify a different one.
=head2 Configuration
=head3 warnings
Please sign in to comment.
Something went wrong with that request. Please try again.