Stephan Kulow
2011-04-21 04:49:52 +00:00
committed by Git OBS Bridge
commit 99b80324b1
5 changed files with 197 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d6d7c82b2eedf1080feee8a8ff571b7300eb1e496267125da18774d79c3715ca
size 47636

View File

@@ -0,0 +1,6 @@
-------------------------------------------------------------------
Thu Apr 21 04:49:47 UTC 2011 - coolo@opensuse.org
- initial package 1.36
* created by cpanspec 1.78.04

164
perl-Cache-FastMmap.spec Normal file
View File

@@ -0,0 +1,164 @@
#
# spec file for package perl-Cache-FastMmap (Version 1.36)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: perl-Cache-FastMmap
Version: 1.36
Release: 1
License: GPL+ or Artistic
%define cpan_name Cache-FastMmap
Summary: Uses an mmap'ed file to act as a shared memory interprocess cache
Url: http://search.cpan.org/dist/Cache-FastMmap/
Group: Development/Libraries/Perl
Source: http://www.cpan.org/authors/id/R/RO/ROBM/%{cpan_name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: perl
BuildRequires: perl-macros
BuildRequires: perl(ExtUtils::MakeMaker)
BuildRequires: perl(Storable)
Requires: perl(Storable)
%{perl_requires}
%description
In multi-process environments (eg mod_perl, forking daemons, etc), it's
common to want to cache information, but have that cache shared between
processes. Many solutions already exist, and may suit your situation
better:
* *
the MLDBM::Sync manpage - acts as a database, data is not automatically
expired, slow
* *
the IPC::MM manpage - hash implementation is broken, data is not
automatically expired, slow
* *
the Cache::FileCache manpage - lots of features, slow
* *
the Cache::SharedMemoryCache manpage - lots of features, VERY slow. Uses
IPC::ShareLite which freeze/thaws ALL data at each read/write
* *
the DBI manpage - use your favourite RDBMS. can perform well, need a DB
server running. very global. socket connection latency
* *
the Cache::Mmap manpage - similar to this module, in pure perl. slows
down with larger pages
* *
the BerkeleyDB manpage - very fast (data ends up mostly in shared memory
cache) but acts as a database overall, so data is not automatically
expired
In the case I was working on, I needed:
* *
Automatic expiry and space management
* *
Very fast access to lots of small items
* *
The ability to fetch/store many items in one go
Which is why I developed this module. It tries to be quite efficient
through a number of means:
* *
Core code is written in C for performance
* *
It uses multiple pages within a file, and uses Fcntl to only lock a page
at a time to reduce contention when multiple processes access the cache.
* *
It uses a dual level hashing system (hash to find page, then hash within
each page to find a slot) to make most 'get()' calls O(1) and fast
* *
On each 'set()', if there are slots and page space available, only the
slot has to be updated and the data written at the end of the used data
space. If either runs out, a re-organisation of the page is performed to
create new slots/space which is done in an efficient way
The class also supports read-through, and write-back or write-through
callbacks to access the real data if it's not in the cache, meaning that
code like this:
my $Value = $Cache->get($Key);
if (!defined $Value) {
$Value = $RealDataSource->get($Key);
$Cache->set($Key, $Value)
}
Isn't required, you instead specify in the constructor:
Cache::FastMmap->new(
...
context => $RealDataSourceHandle,
read_cb => sub { $_[0]->get($_[1]) },
write_cb => sub { $_[0]->set($_[1], $_[2]) },
);
And then:
my $Value = $Cache->get($Key);
$Cache->set($Key, $NewValue);
Will just work and will be read/written to the underlying data source as
needed automatically.
%prep
%setup -q -n %{cpan_name}-%{version}
%build
%{__perl} Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}"
%{__make} %{?_smp_mflags}
%check
%{__make} test
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%clean
%{__rm} -rf %{buildroot}
%files -f %{name}.files
%defattr(-,root,root,755)
%doc Changes README
%changelog