Cache-RamDisk

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

necessary to hold the required user space, depending on the respective
parameters under which the system's individual kernel had been compiled.
The system user and group who owns the cache can be specified for the
whole rd bunch, say cache.


REQUIRES

Perl B<5.6.1> on a Linux/ Unix System containing the following binaries:

   chown, mkdir, mke2fs, mount, touch, umount

The package uses these Perl modules available from CPAN:

   IPC::Shareable
   IPC::SysV
   Filesys::Df
   Filesys::Statvfs
   File::stat
   Fcntl
   Symbol

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

A fallback policy by which you may use parts of your cache as a convenient substitute for SysV shared
memory. Values set for the cache keys are ignored - which means that you will have
to invalidate objects on this type of cache "by hand". Indexes are being kept up to date by simple
C<unshift()>s and C<splice()>s. B<Note: the invalidate() method is not part of v0.1.2!>


=head1 REQUIRES

Perl B<5.6.1> on a Linux/ Unix System containing the following binaries:

   chown, mkdir, mke2fs, mount, umount

The package uses these Perl modules available from CPAN:

   IPC::Shareable
   IPC::SysV
   Filesys::Df
   Filesys::Statvfs
   File::stat
   Fcntl
   Symbol

lib/Cache/RamDisk/Functions.pm  view on Meta::CPAN

   cache_install
   cache_status
   cache_remove
   cache_objects


=head1 REQUIRES

Perl B<5.6.1> on a Linux/ Unix System containing the following binaries:

   chown, mkdir, mke2fs, mount, umount

The package uses these Perl modules available from CPAN:

   IPC::Shareable
   IPC::SysV
   Filesys::Df
   Filesys::Statvfs
   File::stat
   Fcntl
   Symbol

lib/Cache/RamDisk/Functions.pm  view on Meta::CPAN

      }
      if (-e "/dev/ram$i") {
        if (system("mke2fs -q -N".$args->{'INodes'}." /dev/ram$i") < 0 ||
             system("mkdir -p $rdpath") < 0 ||
             system("mount /dev/ram$i $rdpath")) {
            warn "Error while creating /dev/ram$i on $rdpath: $!";
            return $ret;
         }
         $ret->{'BSize'} = (statvfs $rdpath)[0] unless $i;

         # chowning must not affect a 'lost+found' directory, that's why it's not done recursively
         # for the whole of each disk, but lets the '.' directory belong to root
         foreach (@keys) {
            unless (mkdir "$rdpath/$_") {
               warn "Error while creating directories on $rdpath: $!";
               return $ret;
            }
            if (system("chown -R ".$args->{'User'}.".".$args->{'Group'}." $rdpath/$_") < 0) {
               warn "Unable to change ownership of $rdpath/$_: $!";
               return $ret;
            }
         }
         @stat = statvfs($rdpath);      # df doesn't return the blocksize ?!
         $ret->{'Blocks'} += $stat[4];
         $ret->{$i} = $stat[0];
         $ret->{'Disks'} = $i;
         last if $ret->{'Blocks'} > $args->{'Size'}*$ret->{'BSize'};



( run in 3.026 seconds using v1.01-cache-2.11-cpan-71847e10f99 )