age CHI::Serializer::JSON;
$CHI::Serializer::JSON::VERSION = '0.61';
use CHI::Util qw(json_encode json_decode);
use Moo;
use strict;
use warnings;
sub serialize {
return json_encode( $_[1] );
}
sub deserialize {
return json_decode( $_[1] );
}
1;
s : Tests {
my $self = shift;
return 'author testing only - possible differences between JSON versions'
unless ( $ENV{AUTHOR_TESTING} );
my $stats = $self->testing_chi_root_class->
IsSubcache;
use CHI::Driver::Role::Universal;
use CHI::Serializer::Storable;
use CHI::Serializer::JSON;
use CHI::Util qw(parse_duration);
use CHI::Types qw(:all);
use Digest::MD5;
use Encode;
use Hash
_serializer = CHI::Serializer::Storable->new();
my $default_key_serializer = CHI::Serializer::JSON->new();
my $default_key_digester = Digest::MD5->new();
my @common_params;
{
my %attr = (
package CHI::Stats;
$CHI::Stats::VERSION = '0.61';
use CHI::Util qw(json_encode json_decode);
use List::Util qw(sum);
use Log::Any qw($log);
use Moo;
use strict;
use warnings;
has 'chi_root_class' =>
$_, int( $data{$_} ) ) : ( $_, $data{$_} ) }
keys(%data);
$log->infof( 'CHI stats: %s', json_encode( \%data ) );
}
sub format_time {
my ($time) = @_;
my ( $sec, $min, $hour, $mday,
{
chomp($line);
if ( my ($json) = ( $line =~ /CHI stats: (\{.*\})$/ ) ) {
my %hash = %{ json_decode($json) };
my $root_class = delete( $ha
mper;
use Data::UUID;
use Fcntl qw( :DEFAULT );
use File::Spec::Functions qw(catdir catfile);
use JSON::MaybeXS;
use Time::Duration::Parse;
use Try::Tiny;
use strict;
use warnings;
use base qw(Exporte
XPORT_OK = qw(
can_load
dump_one_line
fast_catdir
fast_catfile
has_moose_class
json_decode
json_encode
parse_duration
parse_memory_size
read_file
read_dir
unique_id
write_fil
emory size '$size'";
}
}
my $json = JSON::MaybeXS->new( utf8 => 1, canonical => 1 );
sub json_decode {
$json->decode( $_[0] );
}
sub json_encode {
$json->encode( $_[0] );
}
1;
__END__
See L</serializer>
above for the different ways this can be passed in. The default is to use the
JSON backend in canonical mode (sorted hash keys).
=item label [STRING]
A label for the cache as a w