| 1 | package Plack::Session::Store::RedisFast::Encoder::MojoJSON; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use 5.008_005; | ||
| 7 | |||
| 8 | use Mojo::JSON qw( decode_json encode_json ); | ||
| 9 | |||
| 10 | sub new { | ||
| 11 | my ($class) = @_; | ||
| 12 | |||
| 13 | bless {}, $class; | ||
| 14 | } | ||
| 15 | |||
| 16 | sub encode { | ||
| 17 | my ( $self, $thing ) = @_; | ||
| 18 | |||
| 19 | encode_json($thing); | ||
| 20 | } | ||
| 21 | |||
| 22 | sub decode { | ||
| 23 | my ( $self, $bytes ) = @_; | ||
| 24 | |||
| 25 | decode_json($bytes); | ||
| 26 | } | ||
| 27 | |||
| 28 | 1; | ||
| 29 | |||
| 30 | __END__ |