NAME

WWW::ARDB::Cache - File-based cache for WWW::ARDB

VERSION

version 0.002

SYNOPSIS

use WWW::ARDB::Cache;

my $cache = WWW::ARDB::Cache->new;

# Store data
$cache->set('items', {}, $data);

# Retrieve data
my $cached = $cache->get('items', {});

# Clear specific endpoint
$cache->clear('items');

# Clear all
$cache->clear;

DESCRIPTION

This module provides file-based caching for API responses. Cache files are stored in the XDG cache directory on Unix systems (~/.cache/ardb) or LOCALAPPDATA on Windows (%LOCALAPPDATA%\ardb).

cache_dir

Path::Tiny object for the cache directory. Defaults to platform-specific location: ~/.cache/ardb on Unix or %LOCALAPPDATA%/ardb on Windows.

namespace

String prefix for cache keys. Defaults to default. Can be used to segregate caches for different purposes.

get

my $cached = $cache->get($endpoint, \%params);

Retrieve cached data for an endpoint with the given parameters. Returns the cached data or undef if not found.

set

$cache->set($endpoint, \%params, $data);

Store data in cache for an endpoint with the given parameters.

clear

$cache->clear($endpoint);  # Clear specific endpoint
$cache->clear;             # Clear all cached data

Clear cached data. If $endpoint is provided, only clears cache files for that endpoint. Otherwise clears all cache files.

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-www-ardb/issues.

IRC

You can reach Getty on irc.perl.org for questions and support.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus.

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