Jump to content

User:AnomieBOT/source/AnomieBOT/API/Cache/Encrypted.pm/doc

From Wikipedia, the free encyclopedia

NAME

[edit]

AnomieBOT::API::Cache::Encrypted - AnomieBOT API cache helper for encrypted data

SYNOPSIS

[edit]
 use AnomieBOT::API::Cache;
 
 my $cache = AnomieBOT::API::Cache->create( $class, $optionString );
 $cache->set( 'foo', 'bar' );
 say $cache->get( 'foo' );  # Outputs "bar"

DESCRIPTION

[edit]

AnomieBOT::API::Cache::Encrypted adds some utility functions to AnomieBOT::API::Cache for encrypting the data before storing it.

METHODS

[edit]

In addition to the methods inherited from the base class, the following are available.

AnomieBOT::API::Cache::Encrypted->new( $optionString )
Creates a new AnomieBOT::API::Cache::Encrypted object, which should be reblessed as a subclass. The option string is a semicolon-separated list of key-value pairs; if the value must contain a semicolon or backslash, escape it using a backslash.
Recognized keys are:
encrypt
Key to be used when encrypting the data.
$cache->encode_data( $key, $value )
Encodes a Perl data value into binary. $value may be a scalar or anything accepted by Storable::freeze().
Returns the binary data and flags on success, or undef on error.
$cache->decode_data( $key, $data, $flags )
Decodes binary data into a Perl value, the opposite of $cache->encode_data().
Returns the Perl value on success, or undef on error.
[edit]

Copyright 2013 Anomie

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.