NAME

Tie::Array::Expire - Array with expiring elements

VERSION

This document describes version 0.001 of Tie::Array::Expire (from Perl distribution Tie-Array-Expire), released on 2017-06-07.

SYNOPSIS

use Tie::Array::Expire;

# the elements will expire/disappear after 5 minutes (300 seconds)
tie my @ary, 'Tie::Array::Expire', 300;

push @ary, 1, 2, 3;

# 3 minutes later
push @ary, 4, 5;
unshift @ary, 6;

# 3 minutes later
print @ary; # (6 5 4) (the elements 1, 2, 3 have expired)

# 5 minutes later
print @ary; # () (the elements 6, 5, 4 have also expired)

DESCRIPTION

This module allows you to create an array with the elements autodisappearing after a specified expiry time. This array can be used in, e.g.: rate control checking ("maximum sending 20 emails in 4 hours").

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Tie-Array-Expire.

SOURCE

Source repository is at https://github.com/perlancar/perl-Tie-Array-Expire.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Tie-Array-Expire

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

SEE ALSO

Algorithm::FloodControl

Tie::Array::QueueExpire

CHI

Tie::Scalar::Expire, Tie::Hash::Expire

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by perlancar@cpan.org.

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