NAME
Data::AnyXfer::Elastic::Import::Utils::Buffer - Buffer class
DESCRIPTION
This module provides methods for buffer action
SYNOPSIS
use Data::AnyXfer::Elastic::Import::Utils::Buffer;
my $buffer = Data::AnyXfer::Elastic::Import::Utils::Buffer->new(
callback => $sub );
# push data into buffer
$buffer->push(@data);
# called automatically when more than c<max_size> items have
# been added to the buffer using c<push>
$buffer->flush();
ATTRIBUTES
max_size
size of the buffer, default is 200
callback
# Callback must follow the call signature
$callback->(@data_entries);
callback function which will process the data once the buffer
has been filled
push
$buffer->push(@data);
pushes data to buffer
flush
$buffer->flush();
passes data to callback and clears buffer
COPYRIGHT
This software is copyright (c) 2019, Anthony Lucas.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.