NAME

Meta::Lang::Xql::Cache - cache XML::XQL::Query objects according to name or content.

COPYRIGHT

Copyright (C) 2001, 2002 Mark Veltzer; All rights reserved.

LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.

DETAILS

MANIFEST: Cache.pm
PROJECT: meta
VERSION: 0.00

SYNOPSIS

package foo;
use Meta::Lang::Xql::Cache qw();
my($object)=Meta::Lang::Xql::Cache->new();
my($result)=$object->method();

DESCRIPTION

The idea of this module is to ease development of code which does heavy use of XML::XQL::Query objects and let the programmer stop worrying about allocating the same XML::XQL::Query object twice and wasting resources.

The developer allocates a single object of type Meta::Lang::Xql::Cache and asks it to create XML::XQL::Query objects. If you ask it to create an object with the same XQL code then it returns the object already created. In addition you can give each object a symbolic name and then retrieve each query object (or code) using that symbolic name.

Have fun!

FUNCTIONS

BEGIN()
init($)
insert($$$)
get_by_name($$)
get_by_xql($$)
remove_by_name($$)
remove_by_xql($$)
size($)
TEST($)

FUNCTION DOCUMENTATION

insert($$$)

This method receives a name and a content of an XQL statement. The return is an XML::XQL::Query object to be used. Create all your XML::XQL::Query objects using this method. This is a static method.

get_by_name($$)

This method will retrieve an XML::XQL::Query according to it's name.

get_by_xql($$)

This method will retrieve an XML::XQL::Query according to it's code.

remove_by_name($$)

This will remove an XML::XQL::Query from the cache according to name.

remove_by_xql($$)

This will remove an XML::XQL::Query from the cache according to code.

size($)

This method will return the size of the XQL cache. This means number of entries in the name caches and NOT number of queries.

TEST($)

This is a testing suite for the Meta::Lang::Xql::Cache module. This test is should be run by a higher level management system at integration or release time or just as a regular routine to check that all is well.

The tests creats a cache, puts some stuff into it, prints the size, removes an element and prints the size again. Pretty simple but should catch most people breaking the code (unless they are clever).

SUPER CLASSES

None.

BUGS

None.

AUTHOR

Name: Mark Veltzer
Email: mailto:veltzer@cpan.org
WWW: http://www.veltzer.org
CPAN id: VELTZER

HISTORY

0.00 MV teachers project

SEE ALSO

Meta::Class::MethodMaker(3), Meta::Ds::Map(3), Meta::Lang::Xql::Query(3), Meta::Utils::Output(3), Meta::Utils::System(3), strict(3)

TODO

-add method which retrieves number of objects of type XML::XQL::Query which are held.