Tie::IxHash::FixedSize - Tie::IxHash with a fixed maximum size
version 1.02
use Tie::IxHash::FixedSize; tie my %h, 'Tie::IxHash::FixedSize', {size => 3}, one => 1, two => 2, three => 3; print join ' ', keys %h; # prints 'one two three' $h{four} = 4; # key 'one' is removed, 'four' is added print join ' ', keys %h; # prints 'two three four'
Hashes tied with Tie::IxHash::FixedSize behave exactly like normal Tie::IxHash hashes, except the maximum number of keys that can be held by the hash is limited by a specified size. Once the number of keys in the hash exceeds this size, the oldest keys in the hash will automatically be removed.
size
The size parameter to tie() specifies the maximum number of keys that the hash can hold. When the hash exceeds this number of keys, the first entries in the hash will automatically be removed until the number of keys in the hash does not exceed the size parameter. If no size parameter is given, then the hash will behave exactly like a plan Tie::IxHash, and the number of keys will not be limited.
tie()
Tie::IxHash
The development version is on github at http://https://github.com/mschout/tie-ixhash-fixedsize and may be cloned from git://https://github.com/mschout/tie-ixhash-fixedsize.git
Please report any bugs or feature requests on the bugtracker website https://github.com/mschout/tie-ixhash-fixedsize/issues
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.
Michael Schout <mschout@cpan.org>
This software is copyright (c) 2018 by Michael Schout.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Tie::IxHash::FixedSize, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tie::IxHash::FixedSize
CPAN shell
perl -MCPAN -e shell install Tie::IxHash::FixedSize
For more information on module installation, please visit the detailed CPAN module installation guide.