http://qs321.pair.com?node_id=745566


in reply to thread-safe mmap module ?

Never used them myself, but a CPAN search for shared cache brings up a number of promising looking modules, including IPC::SharedCache and Cache::FastMmap. The documentation from Cache::FastMmap says:
It uses fcntl locking to ensure multiple processes can safely access the cache at the same time.
so it should certainly be thread-safe.

Replies are listed 'Best First'.
Re^2: thread-safe mmap module ?
by perrin (Chancellor) on Feb 22, 2009 at 00:51 UTC
    I don't recommend using IPC::SharedCache. It's slow, and the author himself (samtregar) suggest using something else these days, as you can see in the reviews.
Re^2: thread-safe mmap module ?
by jdd (Acolyte) on Feb 21, 2009 at 22:35 UTC
    There is a concern with the win32 support and Cache::FastMmap warns:

    Cache::FastMmap ./.. will not work on Windows or Win32 like environments.

    and a google search on IPC::SharedCache says something similar ! Unfortunate, I guess I can fall back to a Tie::Cache or a DB backend module for win32 -; Thanks for your answer btw!
      Another result that came up on that page is Cache::FastMmap::WithWin32, which "is a fork of Cache::FastMmap by Rob Mueller to include the Win32 port by Ash Berlin". Once again, never used them, but maybe this would fit your bill?
        You are hitting exactly the reason why I opened this node (smiles) - If I put Cache::FastMmap::WithWin32 in the apache startup.pl I'll hit this piece of code from the module:
        sub CLONE {
          die "Cache::FastMmap::WithWin32 does not support threads sorry";
        }
        
        Damned I said ! Can't find a win32 thread-safe mmap alternative since then.
Re^2: thread-safe mmap module ?
by zwon (Abbot) on Feb 22, 2009 at 12:14 UTC
    It uses fcntl locking to ensure multiple processes can safely access the cache at the same time.
    so it should certainly be thread-safe.

    I'm sorry but why? Aren't fcntl locks shared between threads?