diff options
author | Florian Pritz <bluewind@xinu.at> | 2018-12-25 09:11:38 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2018-12-25 09:11:38 +0100 |
commit | c8c70d5434e1844161a8b622cfe2e42e04b5fcf5 (patch) | |
tree | 57f1344ac385e1d38ea7c0386711d1d641bd69da /lib/App/ArchLinux/PackagerTools | |
parent | 7376b2321705325b1715a943f24f73060b80075d (diff) | |
download | App-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/App/ArchLinux/PackagerTools')
-rw-r--r-- | lib/App/ArchLinux/PackagerTools/Cache.pm | 15 |
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; |