GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Mojo::Cache(3) User Contributed Perl Documentation Mojo::Cache(3)

Mojo::Cache - Naive in-memory cache

  use Mojo::Cache;

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

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

Mojo::Cache implements the following attributes.

  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.

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

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

Get cached value.

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

Set cached value.

Mojolicious, Mojolicious::Guides, <https://mojolicious.org>.
2021-12-08 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.