The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Log::Message::JSON::Hash - Tie::IxHash(3) wrapper supporting storing cache

SYNOPSIS

  use Log::Message::JSON::Hash;
  use JSON;

  tie my %hash, "Log::Message::JSON::Hash";
  # fill %hash...
  tied(%hash)->cache = encode_json(\%hash);

  # ...

  print tied(%hash)->cache;

DESCRIPTION

This class is a proxy to Tie::IxHash(3). It's a valid class to tie hash to, and above this the class adds possibility of storing a cache.

The cache is cleared on every destructive operation (storing an element, deleting an element and clearing whole hash).

API

Own Methods

new()

Constructor.

cache()
cache($data)

Get or set cache for this object.

Cache will be cleared on any destructive operation performed on this object.

Methods Satisfying tie() API

All the rest of methods are defined to satisfy API for tie() function. They call appropriate methods of underlying Tie::IxHash(3) object.

AUTHOR

Stanislaw Klekot, <cpan at jarowit.net>

LICENSE AND COPYRIGHT

Copyright 2013 Stanislaw Klekot.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

SEE ALSO

Tie::IxHash(3), Tie::Hash(3), tie() in perlfunc(1)