Skip to content

Commit

Permalink
Update after review
Browse files Browse the repository at this point in the history
* use an eval block
* fix a typo
* make it clear variable is a default value
  • Loading branch information
Alexandre Pion committed Nov 6, 2023
1 parent 5a7bd30 commit 4ad20ec
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/Zonemaster/Engine/Nameserver/Cache/RedisCache.pm
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,21 @@ use Zonemaster::Engine::Profile;

use base qw( Zonemaster::Engine::Nameserver::Cache );

eval( <<EOS
eval {
use Data::MessagePack;
use Redis;
EOS
);
};


if ( $@ ) {
die "Cant' use the Redis cache. Make sure the Data::MessagePack and Redis module are installed.\n";
die "Can't use the Redis cache. Make sure the Data::MessagePack and Redis modules are installed.\n";
}

my $redis;
my $config;
our $object_cache = \%Zonemaster::Engine::Nameserver::Cache::object_cache;

my $REDIS_EXPIRE = 5; # seconds
my $REDIS_EXPIRE_DEFAULT = 5; # seconds

has 'redis' => ( is => 'ro' );
has 'config' => ( is => 'ro' );
Expand All @@ -55,7 +54,7 @@ sub new {
$params->{redis} //= $redis;
$params->{data} //= {};
$params->{config} //= $config;
$config->{expire} //= $REDIS_EXPIRE;
$config->{expire} //= $REDIS_EXPIRE_DEFAULT;
my $class = ref $proto || $proto;
my $obj = Class::Accessor::new( $class, $params );

Expand Down

0 comments on commit 4ad20ec

Please sign in to comment.