summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/App/ArchLinux/PackagerTools/Cache.pm15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/App/ArchLinux/PackagerTools/Cache.pm b/lib/App/ArchLinux/PackagerTools/Cache.pm
index c0b1aa6..6bfbd10 100644
--- a/lib/App/ArchLinux/PackagerTools/Cache.pm
+++ b/lib/App/ArchLinux/PackagerTools/Cache.pm
@@ -33,6 +33,12 @@ Returns a new instance.
method new($class: $context, $deps = {}) {
$deps->{config} //= App::ArchLinux::PackagerTools::Config->new($context);
+ my $config = $deps->{config}->get_config();
+
+ $deps->{CHI} //= CHI->new(
+ driver => 'File',
+ root_dir => $config->{cache}->{root_dir},
+ );
return $class->new_no_defaults($context, $deps);
}
@@ -42,13 +48,6 @@ method new_no_defaults($class: $context, $deps = {}) {
my $self = {};
bless $self, $class;
$self->{deps} = $deps;
-
- my $config = $deps->{config}->get_config();
-
- $self->{CHI} = CHI->new(
- driver => 'File',
- root_dir => $config->{cache}->{root_dir},
- );
$context->{$class} = $self;
return $self;
}
@@ -68,7 +67,7 @@ timeout.
=cut
method compute($key, $timeout, $sub) {
- return $self->{CHI}->compute($key, $timeout, $sub);
+ return $self->{deps}->{CHI}->compute($key, $timeout, $sub);
}
1;