The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Mojo::UserAgent::Role::Cache::Driver::File - Default cache driver for Mojo::UserAgent::Role::Cache

SYNOPSIS

  my $driver = Mojo::UserAgent::Role::Cache::Driver::File->new;

  $driver->set($key, $data);
  $data = $driver->get($key);
  $driver->remove($key);

DESCRIPTION

Mojo::UserAgent::Role::Cache::Driver::File is the default cache driver for Mojo::UserAgent::Role::Cache. It should provide the same interface as CHI.

ATTRIBUTES

root_dir

  $str = $self->root_dir;
  $self = $self->root_dir("/path/to/mojo-useragent-cache");

Where to store the cached files. Defaults to the MOJO_USERAGENT_CACHE_DIR environment variable or a tempdir.

METHODS

get

  $data = $self->get($key);

Retrive data from the cache. Returns undef() if the $key is not "set".

remove

  $self = $self->remove($key);

Removes data from the cache, by $key.

set

  $self = $self->set($key => $data);

Stores new $data in the cache.

SEE ALSO

Mojo::UserAgent::Role::Cache.