summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2018-12-25 09:11:38 +0100
committerFlorian Pritz <bluewind@xinu.at>2018-12-25 09:11:38 +0100
commitc8c70d5434e1844161a8b622cfe2e42e04b5fcf5 (patch)
tree57f1344ac385e1d38ea7c0386711d1d641bd69da /lib
parent7376b2321705325b1715a943f24f73060b80075d (diff)
downloadApp-ArchLinux-PackagerTools-c8c70d5434e1844161a8b622cfe2e42e04b5fcf5.tar.gz
App-ArchLinux-PackagerTools-c8c70d5434e1844161a8b622cfe2e42e04b5fcf5.tar.xz
Cache: Move CHI to deps
Signed-off-by: Florian Pritz <bluewind@xinu.at>
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;