NAME

Wikibase::Cache::Backend::Basic - Wikibase cache backend to local static basic ids (units, common properties)

SYNOPSIS

use Wikibase::Cache::Backend::Basic;

my $obj = Wikibase::Cache::Backend::Basic->new;
my $value = $obj->get($type, $key);
$obj->save($type, $key, $value);

METHODS

new

my $obj = Wikibase::Cache::Backend::Basic->new;

Constructor.

  • data_fh

    Data file handler from which is mapping fetched. Data file is in format parsed by Text::DSV.

    Default value is mapping in this file on the end.

Returns instance of object.

get

my $value = $obj->get($type, $key);

Get cache value for $type and $key. Possible types are 'description' and 'label'.

Returns string.

save

$obj->save($type, $key, $value);

Save method is not implemented in this implementation of backend. Goes to error.

ERROR

new():
        From Class::Utils::set_params():
                Unknown parameter '%s'.

get():
        Type '%s' isn't supported.
        Type must be defined.';

save():
        Type '%s' isn't supported.
        Type must be defined.';
        Wikibase::Cache::Backend::Basic doesn't implement save() method.

EXAMPLE

use strict;
use warnings;

use Wikibase::Cache::Backend::Basic;

my $obj = Wikibase::Cache::Backend::Basic->new;

# Print out.
print 'P31 label: '.$obj->get('label', 'P31')."\n";
print 'P31 description: '.$obj->get('description', 'P31')."\n";

# Output:
# P31 label: instance of
# P31 description: that class of which this subject is a particular example and member

DEPENDENCIES

Class::Utils, Data::Handle, Error::Pure, Text::DSV, Wikibase::Cache::Backend.

REPOSITORY

https://github.com/michal-josef-spacek/Wikibase-Cache-Backend-Basic

AUTHOR

Michal Josef Špaček mailto:skim@cpan.org

http://skim.cz

LICENSE AND COPYRIGHT

© 2021-2023 Michal Josef Špaček

BSD 2-Clause License

VERSION

0.04