The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Math::PartialOrder::Caching - class for partial orders which caches lookup results.

SYNOPSIS

use Math::PartialOrder::Caching;
...

REQUIRES

Math::PartialOrder::Std, Math::PartialOrder, Carp, Exporter

DESCRIPTION

Math::PartialOrder::Caching is a Math::PartialOrder::Base implementation for rooted finite partial orders (datatype hierarchies) which caches the reults of all inheritance- and type-operation lookups using Perl hashes. It inherits from Math::PartialOrder::Std.

Math::PartialOrder::Caching supports all methods described in Math::PartialOrder::Base.

PACKAGE-GLOBAL VARIABLES

  • $CACHE_KEY_SEP

    The value of this variable is a perl string which will be used as a separator between operation- and/or type-identifiers for purposes of placing them in the cache. The default value is ','.

METHODS

Construction & Initialization

  • new( {root=>$r} )

    Creates and returns a new Math::PartialOrder::Caching object rooted at $r, which defaults to 'BOTTOM'.

Additional Hierarchy Maintainence Operations

All additional methods provided by Math::PartialOrder::Std are supported.

Hierarchy Maintainence: Low-level Accessors/Manipulators

All low-level methods provided by Math::PartialOrder::Std are supported.

    * _root(), _root($r)

    Get/set the root of the hierarchy.

    * _incache()

    Returns a reference to the tied inheritance-cache, whose keys are type-name pairs separated by $CACHE_KEY_SEP, "${t1}${CACHE_KEY_SEP}${t2}", and whose values (where they exist) are booleans indicating whether $t1 has $t2 as an ancestor.

    * _get_cached_in($t1,$t2)

    Gets and returns the cached value for the key "${t1}${CACHE_KEY_SEP}${t2}", or undef if not cached.

    * _set_cached_in($t1,$t2)

    Sets and returns the cached value for the key "${t1}${CACHE_KEY_SEP}${t2}" to $val.

    * _opcache()

    Returns a reference to the tied operations-cache, whose keys are operation+type1+type2 triples separated by $CACHE_KEY_SEP, "${op}${CACHE_KEY_SEP}${t1}${CACHE_KEY_SEP}${t2}", and whose values are (references to) the results of the lookup.

    * _get_cached_op($op,$t1,$t2)

    Gets and returns the cached value for the key "${op}${CACHE_KEY_SEP}${t1}${CACHE_KEY_SEP}${t2}", or undef if not cached.

    * _set_cached_op($op,$t1,$t2,$val)

    Sets and returns the cached value for the key "${op}${CACHE_KEY_SEP}${t1}${CACHE_KEY_SEP}${t2}" to $val.

    * _clear_cache()

    Clears all cached relations. Automatically called on destructive hierarchy operations, otherwise never called by default (the cache never expires).

ACKNOWLEDGEMENTS

perl by Larry Wall.

AUTHOR

Bryan Jurish <jurish@ling.uni-potsdam.de>

COPYRIGHT

Copyright (c) 2001, Bryan Jurish. All rights reserved.

This package is free software. You may redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

perl(1). Math::PartialOrder(3pm). Math::PartialOrder::Base(3pm). Math::PartialOrder::Std(3pm). Math::PartialOrder::LRUCaching(3pm). Math::PartialOrder::CMasked(3pm). Math::PartialOrder::CEnum(3pm). Math::PartialOrder::Loader(3pm).

1 POD Error

The following errors were encountered while parsing the POD:

Around line 72:

You can't have =items (as at line 76) unless the first thing after the =over is an =item