Dancer2-Session-DatabasePlugin

 view release on metacpan or  search on metacpan

lib/Dancer2/Session/DatabasePlugin.pm  view on Meta::CPAN

package Dancer2::Session::DatabasePlugin;

use Modern::Perl;
use Moo;
use Data::Dumper;
use Dancer2::Core::Types;
use Dancer2::Plugin::Database;
use Carp qw(croak);
use Ref::Util qw(is_plain_hashref);
use Storable qw(nfreeze thaw);
with 'Dancer2::Core::Role::SessionFactory';
our $VERSION="1.0014";

our $HANDLE_SQL_STRING=\&stub_function;
our $HANDLE_EXECUTE=\&handle_execute;
sub stub_function { }

sub handle_execute {
  my ($name,$sth,@args)=@_;
  $sth->execute(@args);
}

our $CACHE={};

our $FREEZE=\&nfreeze;
our $THAW=\&thaw;

has no_create=>(
  ias=>HashRef,
  is=>'ro',
  default=>sub { return {}},
);

has cache =>(
  isa=>Bool,
  is=>'rw',
  default=>0,
);

has cache_sth=>(
  isa=>Bool,
  is=>'ro',
  default=>0,
);

has sth_cache=>(
  isa=>HashRef,
  default=>sub { $CACHE },
  is=>'ro',
);

has connection=>(
  isa=>Str,
  is=>'rw',
  default=>'foo',
  required=>1,
);

has session_table=>(
  isa=>Str,
  required=>1,
  is=>'rw',
  default=>'SESSIONS',

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.788 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )