Catalyst::Plugin::Cache::Backend::FastMmap - A thin wrapper for


Catalyst-Plugin-Cache-Store-FastMmap documentation Contained in the Catalyst-Plugin-Cache-Store-FastMmap distribution.

Index


Code Index:

NAME

Top

Catalyst::Plugin::Cache::Backend::FastMmap - A thin wrapper for Cache::FastMmap that can handle non refs.

SYNOPSIS

Top

	use Catalyst::Plugin::Cache::Backend::FastMmap;

    my $cache_obj = Catalyst::Plugin::Cache::Backend::FastMmap->new;

    $cache_obj->set( key => [qw/blah blah blah/] );

    $cache_obj->set( key => "this_works_too" ); # non references can also be stored

DESCRIPTION

Top


Catalyst-Plugin-Cache-Store-FastMmap documentation Contained in the Catalyst-Plugin-Cache-Store-FastMmap distribution.

#!/usr/bin/perl

package Catalyst::Plugin::Cache::Backend::FastMmap;
use base qw/Cache::FastMmap/;

use strict;
use warnings;

# wrap everything in a scalar ref so that we can store plain scalars as well

sub get {
    my ( $self, $key ) = @_;
    ${ $self->SUPER::get($key) || return };
}

sub set {
    my ( $self, $key, $value ) = @_;
    $self->SUPER::set( $key => \$value );
}

__PACKAGE__;

__END__