The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Quiq::LockedCounter - Persistenter Zähler mit Lock

BASE CLASS

Quiq::Object

SYNOPSIS

use Quiq::LockedCounter;

$cnt = Quiq::LockedCounter->new($file)->increment;
...
$n = $cnt->count;

DESCRIPTION

Die Klasse realisiert einen Zähler mit Exklusiv-Lock. Der Zählerstand wird in einer Datei gespeichert. Die Datei wird gelockt. Der Lock wird bis zur Destrukturierung des Objekts gehalten.

METHODS

Konstruktor

new() - Instantiiere Counter

Synopsis

$ctr = Quiq::LockedCounter->new($file);

Returns

Objekt

Operationen

count() - Liefere Zählerstand

Synopsis

$n = $ctr->count;

Returns

Zählerstand (Integer)

file() - Liefere Dateipfad

Synopsis

$file = $ctr->file;

Returns

Dateipfad (String)

increment() - Inkrementiere Zählerstand

Synopsis

$ctr = $ctr->increment;

Returns

Objekt

VERSION

1.220

AUTHOR

Frank Seitz, http://fseitz.de/

COPYRIGHT

Copyright (C) 2024 Frank Seitz

LICENSE

This code is free software; you can redistribute it and/or modify it under the same terms as Perl itself.