1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
package Catmandu::Flushable;
use Catmandu::Sane;
our $VERSION = '1.2024';
use Moo::Role;
use namespace::clean;
requires 'commit';
requires 'flush';
before commit => sub {
$_[0]->flush;
};
1;
__END__
=pod
=head1 NAME
Catmandu::Flushable - Optional role for flushable bags
=head1 DESCRIPTION
C<flush> makes sure that data added get persisted to disk for stores that
support this operation (e.g. Elasticsearch).
This role also installs a hook that calls C<flush> on C<commit>.
=head1 SYNOPSIS
$store->bag->flush;
=head1 METHODS
=head2 flush
Flush the bag.
=cut
|