Git Product home page Git Product logo

dancer-session-dbic's Introduction

NAME
    Dancer::Session::DBIC - DBIx::Class session engine for Dancer

VERSION
    0.003

DESCRIPTION
    This module implements a session engine for Dancer by serializing the
    session, and storing it in a database via DBIx::Class. The default
    serialization method is JSON, though one can specify any serialization
    format you want. YAML and Storable are viable alternatives.

    JSON was chosen as the default serialization format, as it is fast,
    terse, and portable.

SYNOPSIS
    Example configuration:

        session: "DBIC"
        session_options:
          dsn:      "DBI:mysql:database=testing;host=127.0.0.1;port=3306" # DBI Data Source Name
          schema_class:    "Interchange6::Schema"  # DBIx::Class schema
          user:     "user"      # Username used to connect to the database
          pass: "password"  # Password to connect to the database
          resultset: "MySession" # DBIx::Class resultset, defaults to Session
          id_column: "my_session_id" # defaults to sessions_id
          data_column: "my_session_data" # defaults to session_data

    In conjunction with Dancer::Plugin::DBIC, you can simply use the schema
    object provided by this plugin in your application:

        set session_options => {schema => schema};

    Custom serializer / deserializer can be specified as follows:

        set 'session_options' => {
            schema       => schema,
            serializer   => sub { YAML::Dump(@_); },
            deserializer => sub { YAML::Load(@_); },
        };

SESSION EXPIRATION
    A timestamp field that updates when a session is updated is recommended,
    so you can expire sessions server-side as well as client-side.

    This session engine will not automagically remove expired sessions on
    the server, but with a timestamp field as above, you should be able to
    to do this manually.

METHODS
  create()
    Creates a new session. Returns the session object.

  flush()
    Write the session to the database. Returns the session object.

  retrieve($id)
    Look for a session with the given id.

    Returns the session object if found, `undef' if not. Logs a debug-level
    warning if the session was found, but could not be deserialized.

  destroy()
    Remove the current session object from the database.

SEE ALSO
    Dancer, Dancer::Session

AUTHOR
    Stefan Hornburg (Racke) <[email protected]>

ACKNOWLEDGEMENTS
    Based on code from Dancer::Session::DBI written by James Aitken and code
    from Dancer::Plugin::DBIC written by Naveed Massjouni.

COPYRIGHT AND LICENSE
    This software is copyright (c) Stefan Hornburg.

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.

dancer-session-dbic's People

Contributors

racke avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.