Dancer::Session::ElasticSearch - ElasticSearch based session engine for Dancer
This module implements a session engine storing session variables in an ElasticSearch index. It also signs IDs to thwart tampering and guessing.
In config.yml
session: "ElasticSearch" session_options: connection: ... settings to pass to ElasticSearch index: "my_index" # defaults to "session" type: "my_session" # defaults to "session" signing: secret: "ldjaldjaklsdanm.m" # required for signing IDs length: 10 # length of the salt and hash. defaults to 10
This session engine will not remove expired sessions on the server, but as it's ElasticSearch you can set a ttl on the documents when you create your ES index and let ES do the work for you.
Creates a new session. Returns the session object.
Write the session to ES. Returns the session object.
Look for a session with the given id.
Returns the session object if found, undef if not.
undef
Remove the current session object from ES
Connect to ElasticSearch and returns a handle
Overload the init method in Dancer::Session::Abstract to not create an ID as we will use the ElasticSearch ID instead.
not
Verifies a signed ID
Signs an ID
Creates a hash from the $id, $salt and secret key as found in the config
Fork a copy for yourself from https://github.com/babf/Dancer-Session-ElasticSearch
Dancer, Dancer::Session
To install Dancer::Session::ElasticSearch, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dancer::Session::ElasticSearch
CPAN shell
perl -MCPAN -e shell install Dancer::Session::ElasticSearch
For more information on module installation, please visit the detailed CPAN module installation guide.