Tie::IxHash::FixedSize - Tie::IxHash with a fixed maximum size


Tie-IxHash-FixedSize documentation  | view source Contained in the Tie-IxHash-FixedSize distribution.

Index


NAME

Top

Tie::IxHash::FixedSize - Tie::IxHash with a fixed maximum size

SYNOPSIS

Top

  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'

ABSTRACT

Top

Hashes tied to Tie::IxHash::FixedSize will only hold a fixed maximum number of keys before automatically removing old keys.

DESCRIPTION

Top

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.

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.

SOURCE

Top

You can contribute or fork this project via github:

http://github.com/mschout/tie-ixhash-fixedsize

 git clone git://github.com/mschout/tie-ixhash-fixedsize.git

BUGS

Top

Please report any bugs or feature requests to bug-tie-ixhash-fixedsize@rt.cpan.org, or through the web interface at http://rt.cpan.org/.

AUTHOR

Top

Michael Schout <mschout@cpan.org>

COPYRIGHT AND LICENSE

Top

SEE ALSO

Top

Tie::IxHash


Tie-IxHash-FixedSize documentation  | view source Contained in the Tie-IxHash-FixedSize distribution.