Skip Menu |

This queue is for tickets about the Cache-FastMmap CPAN distribution.

Report information
The Basics
Id: 16762
Status: resolved
Priority: 0/
Queue: Cache-FastMmap

People
Owner: Nobody in particular
Requestors: nothingmuch [...] woobling.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.09
Fixed in: 1.13



Subject: Can't store non reference data in cache
I used Cache::FastMmap to store integer values in the cache, and it complained that it can only store references. For example: use Cache::FastMmap; my $c = Cache::FastMmap->new; $c->set( bar => 1); yields: not a reference at /Library/Perl/5.8.6/darwin-thread-multi-2level/Cache/FastMmap.pm line 570 My ugly workaround is to store $c->set( bar => { value => 1 } ); but this reduces the readability of the code by a lot.
I'd like to clarify that i'm not asking for Storable to be fixed, but rather for a workaround on behalf of Cache::FastMmap to be added, like $thing = Cache::FastMmap::RefButValue->new($thing) if !ref($thing); and then on load: $thing = $thing->value if (ref $thing eq "Cache::FastMmap::RefButValue");
You can use the "raw_values => 1" parameter when you instantiate the cache to store non-reference data. My plan is to change this so that when raw_values => 0 (the default), you can store any type of data. Rob
This was fixed in 1.13. When you use "raw_values => 0", you can store scalars or references in the cache correctly.
Subject: Re: [rt.cpan.org #16762] Can't store non reference data in cache
Date: Mon, 2 Apr 2007 04:54:54 -0400
To: via RT <bug-Cache-FastMmap [...] rt.cpan.org>
From: Yuval Kogman <nothingmuch [...] woobling.org>
Cool, thanks!