{
    "content": [
        {
            "type": "text",
            "text": "# Cache::File::Heap (perldoc)\n\n## NAME\n\nCache::File::Heap - A file based heap for use by Cache::File\n\n## SYNOPSIS\n\nuse Cache::File::Heap;\n$heap = Cache::File::Heap->new('/path/to/some/heap/file');\n$heap->add($key, $val);\n($key, $val) = $heap->minimum;\n($key, $val) = $heap->extractminimum;\n$heap->delete($key, $val);\n\n## DESCRIPTION\n\nThis module is a wrapper around a Berkeley DB using a btree structure to implement a heap. It is\nspecifically for use by Cache::File for storing expiry times (although with a bit of work it\ncould be made more general).\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **CONSTRUCTOR**\n- **METHODS**\n- **SEE ALSO**\n- **AUTHOR**\n- **COPYRIGHT**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Cache::File::Heap",
        "section": "",
        "mode": "perldoc",
        "summary": "Cache::File::Heap - A file based heap for use by Cache::File",
        "synopsis": "use Cache::File::Heap;\n$heap = Cache::File::Heap->new('/path/to/some/heap/file');\n$heap->add($key, $val);\n($key, $val) = $heap->minimum;\n($key, $val) = $heap->extractminimum;\n$heap->delete($key, $val);",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "CONSTRUCTOR",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 30,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 8,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Cache::File::Heap - A file based heap for use by Cache::File\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use Cache::File::Heap;\n\n$heap = Cache::File::Heap->new('/path/to/some/heap/file');\n$heap->add($key, $val);\n($key, $val) = $heap->minimum;\n($key, $val) = $heap->extractminimum;\n$heap->delete($key, $val);\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This module is a wrapper around a Berkeley DB using a btree structure to implement a heap. It is\nspecifically for use by Cache::File for storing expiry times (although with a bit of work it\ncould be made more general).\n\nSee LIMITATIONS below.\n",
                "subsections": []
            },
            "CONSTRUCTOR": {
                "content": "my $heap = Cache::File::Heap->new( [$dbfile] );\n\nThe heap constructor takes an optional argument which is the name of the database file to open.\nIf specified, it will attempt to open the database during construction. A new Cache::File::Heap\nblessed reference will be returned, or undef if the open failed.\n",
                "subsections": []
            },
            "METHODS": {
                "content": "$h->open($dbfile)\nOpens the specified database file.\n\n$h->close()\nCloses a previously opened heap database. Note that the database will be automatically\nclosed when the heap reference is destroyed.\n\n$h->add($key, $val)\nAdds a key and value pair to the heap. Currently the key should be a number, whilst the\nvalue may be any scalar. Invokes 'die' on failure (use eval to catch it).\n\n$h->delete($key, $val)\nRemoves a key and value pair from the heap. Returns 1 if the pair was found and removed, or\n0 otherwise.\n\n($key, $val) = $h->minimum()\nIn list context, returns the smallest key and value pair from the heap. In scalar context\nonly the key is returned. Note smallest is defined via a numerical comparison (hence keys\nshould always be numbers).\n\n($key, $vals) = $h->minimumdup()\nIn list context, returns the smallest key and an array reference containing all the values\nfor that key from the heap. In scalar context only the key is returned.\n\n($key, $val) = $h->extractminimum()\nAs for $h->minimum(), but the key and value pair is removed from the heap.\n\n($key, $vals) = $h->extractminimumdup()\nAs for $h->minimumdup(), but all the values are removed from the heap.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "Cache::File\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Chris Leishman <chris@leishman.org>\nBased on work by DeWitt Clinton <dewitt@unto.net>\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright (C) 2003-2006 Chris Leishman.  All Rights Reserved.\n\nThis module is distributed on an \"AS IS\" basis, WITHOUT WARRANTY OF ANY KIND, either expressed\nor implied. This program is free software; you can redistribute or modify it under the same\nterms as Perl itself.\n\n$Id: Heap.pm,v 1.6 2006/01/31 15:23:58 caleishm Exp $\n",
                "subsections": []
            }
        }
    }
}