|
Lines 22-27
sub startup {
Link Here
|
| 22 |
$self->plugin('RESTV1'); |
22 |
$self->plugin('RESTV1'); |
| 23 |
|
23 |
|
| 24 |
$self->hook(before_dispatch => \&_before_dispatch); |
24 |
$self->hook(before_dispatch => \&_before_dispatch); |
|
|
25 |
$self->hook(around_action => \&_around_action); |
| 25 |
|
26 |
|
| 26 |
# Everything after this comment is only needed to use Mojolicious |
27 |
# Everything after this comment is only needed to use Mojolicious |
| 27 |
# controllers. |
28 |
# controllers. |
|
Lines 55-63
sub _before_dispatch {
Link Here
|
| 55 |
|
56 |
|
| 56 |
$c->req->url->parse($url); |
57 |
$c->req->url->parse($url); |
| 57 |
|
58 |
|
| 58 |
# Flush caches before every request |
59 |
} |
| 59 |
Koha::Caches->flush_L1_caches(); |
60 |
|
|
|
61 |
sub _around_action { |
| 62 |
my ($next, $c, $action, $last) = @_; |
| 63 |
|
| 64 |
# Flush memory caches before every request |
| 65 |
my $caches = $Koha::Caches::singleton_caches; |
| 66 |
if ($caches) { |
| 67 |
foreach my $key (keys %$caches) { |
| 68 |
my $cache = $caches->{$key}; |
| 69 |
if (ref $cache->{cache} eq 'Cache::Memory') { |
| 70 |
$cache->flush_all; |
| 71 |
} |
| 72 |
$cache->flush_L1_cache; |
| 73 |
} |
| 74 |
} |
| 75 |
$Koha::Caches::singleton_caches = {}; |
| 60 |
Koha::Cache::Memory::Lite->flush(); |
76 |
Koha::Cache::Memory::Lite->flush(); |
|
|
77 |
|
| 78 |
return $next->(); |
| 61 |
} |
79 |
} |
| 62 |
|
80 |
|
| 63 |
1; |
81 |
1; |
| 64 |
- |
|
|