<<

NAME

pfconfig::cached_hash

DESCRIPTION

pfconfig::cached_hash

This module serves as an interface to create a hash that will proxy the access to it's attributes to the pfconfig service

It is used as a bridge between a pfconfig namespace element and a hash without having a memory footprint unless when accessing data in the hash

USAGE

This class is used with tiying

Example : my %hash; tie %hash, 'pfconfig::cached_hash', 'resource::default_switch'; print $hash{_ip};

This ties %hash to the namespace 'resource::default_switch' defined in lib/pfconfig/namespaces/ and served though pfconfig

The access to the attribute _ip then generates a GET though pfconfig that uses a UNIX socket

In order to call a method on this tied object my @keys = tied(%hash)->keys

TIEHASH

Constructor of the hash

FETCH

Access an element by key in the hash Will serve it from it's subcache (per process) if it has it and it's still valid Other than that it proxies the call to pfconfig

keys

Added method that can be called on the underlying object of the tied hash Will do 1 call to fetch all the keys of the hash instead of using the next key method Call it using tied(%hash)->keys

FIRSTKEY

Get the first key of the hash Proxies to pfconfig

FIRSTKEY

Get the next key of the hash Proxies to pfconfig

STORE

Set a value in the hash Stores it without any saving capability

STORE

Check if a key exists in the hash Proxies to pfconfig

values

Added method that can be called on the underlying object of the tied hash Will return all the values of the hash. Mostly for internal use Call it using tied(%hash)->values

search

Used to search for an element in our hash that has a specific value in one of it's field

Ex (%h is us) : my %h = { 'test' => {'result' => '2'}, 'test2' => {'result' => 'success'} }

Searching for field result with value 'success' would return the value of test2

This has to be called on the underlying object of the tied hash Call it using tied(%hash)->search('result', 'success')

AUTHOR

Inverse inc. <info@inverse.ca>

COPYRIGHT

Copyright (C) 2005-2015 Inverse inc.

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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

POD ERRORS

Hey! The above document had some coding errors, which are explained below:

Around line 198:

'=item' outside of any '=over'

<<