Flux::File - file storage
$storage = Flux::File->new($filename); $in = $storage->in( Flux::File::Cursor->new($posfile) );
This is a simplest implementation of
It stores lines by appending them to the file. It supports clients identifiable by Flux::File::Cursor objects.
It also have several options for fine control over performance vs data consistency trade-off. (See the constructor documentation below.)
- new($file, [$options])
Create new object.
$fileshould be a name of any writable file into which lines will be appended.
$filedoes not yet exist, it will be created.
Options can contains the following keys:
- lock (default = 1)
Get lock on each write (useful when many processes writes in one file).
- reopen (default = 0)
Reopen file on each write (useful for files, which can be rotated).
- safe (default = 0)
Truncate file to the last endline (useful when your unit for writings is a single lines and you don't want to have a hanging lines in your log in case of failure). If
reopenis true, then file checks on each flush, otherwise it will be checked only at first flush.
Write a new line into the file.
Write multiple lines into the file.
Construct the input stream which reads the file starting from the position saved in
Vyacheslav Matyukhin <email@example.com>
This software is copyright (c) 2013 by Yandex LLC.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.