logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Mojo::Cache - Naive in-memory cache

Attributes

       Mojo::Cache implements the following attributes.

   max_keys
         my $max = $cache->max_keys;
         $cache  = $cache->max_keys(50);

       Maximum number of cache keys, defaults to 100. Setting the value to 0 will disable caching.

Description

       Mojo::Cache is a naive in-memory cache with size limits.

Methods

       Mojo::Cache inherits all methods from Mojo::Base and implements the following new ones.

   get
         my $value = $cache->get('foo');

       Get cached value.

   set
         $cache = $cache->set(foo => 'bar');

       Set cached value.

Name

       Mojo::Cache - Naive in-memory cache

See Also

       Mojolicious, Mojolicious::Guides, <https://mojolicious.org>.

perl v5.40.0                                       2024-12-07                                   Mojo::Cache(3pm)

Synopsis

         use Mojo::Cache;

         my $cache = Mojo::Cache->new(max_keys => 50);
         $cache->set(foo => 'bar');
         my $foo = $cache->get('foo');

See Also