info > Cache::File::Heap

📝 NAME

Cache::File::Heap - A file based heap for use by Cache::File

🚀 Quick Reference

Use CaseCommandDescription
Create a new heap objectCache::File::Heap->new('/path/to/heap')Opens or creates a heap database file
Add a key-value pair$heap->add($key, $val)Inserts a numeric key and scalar value
Get the smallest key-value pair$heap->minimum()Returns the minimum key and its value (list context)
Extract the smallest pair$heap->extract_minimum()Removes and returns the minimum key-value pair
Delete a specific pair$heap->delete($key, $val)Removes a key-value pair, returns 1 if found
Get all values for the smallest key$heap->minimum_dup()Returns the smallest key and an array ref of all its values
Extract all values for the smallest key$heap->extract_minimum_dup()Removes and returns the smallest key and all its values

📋 SYNOPSIS

use Cache::File::Heap;

$heap = Cache::File::Heap->new('/path/to/some/heap/file');
$heap->add($key, $val);
($key, $val) = $heap->minimum;
($key, $val) = $heap->extract_minimum;
$heap->delete($key, $val);

📖 DESCRIPTION

This module is a wrapper around a Berkeley DB using a btree structure to implement a heap. It is specifically for use by Cache::File for storing expiry times (although with a bit of work it could be made more general).

See LIMITATIONS below.

🔧 CONSTRUCTOR

my $heap = Cache::File::Heap->new( [$dbfile] );

The heap constructor takes an optional argument which is the name of the database file to open. If specified, it will attempt to open the database during construction. A new Cache::File::Heap blessed reference will be returned, or undef if the open failed.

đŸ› ī¸ METHODS

🔗 SEE ALSO

Cache::File

👤 AUTHOR

Chris Leishman <chris AT leishman.org>
Based on work by DeWitt Clinton <dewitt AT unto.net>

ÂŠī¸ COPYRIGHT

Copyright (C) 2003-2006 Chris Leishman. All Rights Reserved.

This module is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. This program is free software; you can redistribute or modify it under the same terms as Perl itself.

$Id: Heap.pm,v 1.6 2006/01/31 15:23:58 caleishm Exp $

perl v5.32.0 2021-01-01 Cache::File::Heap(3pm)

Cache::File::Heap
📝 NAME 🚀 Quick Reference 📋 SYNOPSIS 📖 DESCRIPTION 🔧 CONSTRUCTOR đŸ› ī¸ METHODS 🔗 SEE ALSO 👤 AUTHOR ÂŠī¸ COPYRIGHT

Generated by phpman v4.9.26-5-g7740029 Author: Che Dong Under GNU General Public License
2026-08-14 20:43 @2600:1f28:365:80b0:4d23:66fa:c2bb:7bae
CrawledBy CCBot/2.0 (https://commoncrawl.org/faq/)
Valid XHTML 1.0 Transitional!Valid CSS!