Cache-FastMmap

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN


1.32 Thu Jun 18 11:55 2009
  - Better LiveCaches tracking via DESTROY

1.31 Thu Jun 18 11:40 2009
  - when in raw_values => 0 mode, the write_cb is now
    correctly called with thawed data, rather than the
    raw frozen data
  - empty_on_exit correctly called even when a global
    cache is left at interpreter exit time (required
    Scalar::Util qw(weaken) for object tracking)

1.30 Fri May 8  11:10 2009
  - Fix for Mandriva compiler (thanks Jean-Christian Hassler)

1.29 Fri May 1  17:20 2009
  - Support for Windows (thanks to Ash & kmx.at.volny.cz)
    (https://rt.cpan.org/Public/Bug/Display.html?id=45210)
    (https://rt.cpan.org/Public/Bug/Display.html?id=16501)

1.28 Fri Jun 27 11:05 2008

lib/Cache/FastMmap.pm  view on Meta::CPAN

        $Self->{uncompress} = sub { &$uncompress(my $Tmp = shift) };
      }
    } else {
      die "Unrecognized value >$compressor< for `compressor` parameter";
    }
  }

  # If using empty_on_exit, need to track used caches
  my $empty_on_exit = $Self->{empty_on_exit} = int($Args{empty_on_exit} || 0);

  # Need Scalar::Util::weaken to track open caches
  if ($empty_on_exit) {
    eval "use Scalar::Util qw(weaken); 1;"
      || die "Could not load Scalar::Util module: $@";
  }

  # Work out expiry time in seconds
  my $expire_time = $Self->{expire_time} = parse_expire_time($Args{expire_time});

  # Function rounds to the nearest power of 2
  sub RoundPow2 { return int(2 ** int(log($_[0])/log(2)) + 0.1); }

  # Work out cache size

lib/Cache/FastMmap.pm  view on Meta::CPAN

  fc_set_param($Cache, 'share_file', $share_file);
  fc_set_param($Cache, 'permissions', $permissions) if defined $permissions;
  fc_set_param($Cache, 'start_slots', $start_slots);
  fc_set_param($Cache, 'catch_deadlocks', $catch_deadlocks);
  fc_set_param($Cache, 'enable_stats', $enable_stats);

  # And initialise it
  fc_init($Cache);

  # Track cache if need to empty on exit
  weaken($LiveCaches{ref($Self)} = $Self)
    if $empty_on_exit;

  # All done, return PERL hash ref as class
  return $Self;
}

=item I<get($Key, [ \%Options ])>

Search cache for given Key. Returns undef if not found. If
I<read_cb> specified and not found, calls the callback to try



( run in 1.273 second using v1.01-cache-2.11-cpan-65fba6d93b7 )