commit perl-Tie-Cache for openSUSE:Factory
Hello community, here is the log from the commit of package perl-Tie-Cache for openSUSE:Factory checked in at 2014-09-17 17:25:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Tie-Cache (Old) and /work/SRC/openSUSE:Factory/.perl-Tie-Cache.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "perl-Tie-Cache" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Tie-Cache/perl-Tie-Cache.changes 2011-11-21 12:49:21.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.perl-Tie-Cache.new/perl-Tie-Cache.changes 2014-09-17 17:26:15.000000000 +0200 @@ -1,0 +2,10 @@ +Mon Sep 15 15:44:32 UTC 2014 - coolo@suse.com + +- updated to 0.21 + + fixed internal $VERSION number + + added cleaner ref() checking for data size calculations when using a MaxBytes cache, to address bug + https://rt.cpan.org/Public/Bug/Display.html?id=69976 + + updated test.pl to "use Tie::Cache" to prevent test conflicts with Cache.pm +- removed outdated Tie-Cache-0.17.diff + +------------------------------------------------------------------- Old: ---- Tie-Cache-0.17.diff Tie-Cache-0.17.tar.gz New: ---- Tie-Cache-0.21.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Tie-Cache.spec ++++++ --- /var/tmp/diff_new_pack.4RjXPk/_old 2014-09-17 17:26:16.000000000 +0200 +++ /var/tmp/diff_new_pack.4RjXPk/_new 2014-09-17 17:26:16.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package perl-Tie-Cache # -# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2014 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 @@ -15,56 +15,58 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # -# norootforbuild - Name: perl-Tie-Cache -Version: 0.17 -Release: 388 -AutoReqProv: on +Version: 0.21 +Release: 0 +%define cpan_name Tie-Cache +Summary: LRU Cache in Memory +License: GPL-1.0+ or Artistic-1.0 Group: Development/Libraries/Perl -License: Artistic-1.0 -Url: http://cpan.org/modules/by-module/Tie -Summary: Perl module Tie::Cache -Source: Tie-Cache-%{version}.tar.gz -Patch: Tie-Cache-%{version}.diff +Url: http://search.cpan.org/dist/Tie-Cache/ +Source: http://www.cpan.org/authors/id/C/CH/CHAMAS/%{cpan_name}-%{version}.tar.gz +BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build -%{perl_requires} BuildRequires: perl BuildRequires: perl-macros +%{perl_requires} %description -This module implements a least recently used (LRU) cache in memory -through a tie interface. - - - -Authors: --------- - Joshua Chamas <chamas@alumni.stanford.org> +This module implements a least recently used (LRU) cache in memory through +a tie interface. Any time data is stored in the tied hash, that key/value +pair has an entry time associated with it, and as the cache fills up, those +members of the cache that are the oldest are removed to make room for new +entries. + +So, the cache only "remembers" the last written entries, up to the size of +the cache. This can be especially useful if you access great amounts of +data, but only access a minority of the data a majority of the time. + +The implementation is a hash, for quick lookups, overlaying a doubly linked +list for quick insertion and deletion. On a WinNT PII 300, writes to the +hash were done at a rate 3100 per second, and reads from the hash at 6300 +per second. Work has been done to optimize refreshing cache entries that +are frequently read from, code like $cache{entry}, which moves the entry to +the end of the linked list internally. %prep -%setup -n Tie-Cache-%{version} -%patch +%setup -q -n %{cpan_name}-%{version} +find . -type f -print0 | xargs -0 chmod 644 %build -perl Makefile.PL -make %{?_smp_mflags} -make test +%{__perl} Makefile.PL INSTALLDIRS=vendor +%{__make} %{?_smp_mflags} + +%check +%{__make} test %install -rm -rf $RPM_BUILD_ROOT -make DESTDIR=$RPM_BUILD_ROOT install_vendor +%perl_make_install %perl_process_packlist +%perl_gen_filelist -%clean -rm -rf $RPM_BUILD_ROOT - -%files -%defattr(-,root,root) -%doc README CHANGES bench.pl -%doc %{_mandir}/man?/* -%{perl_vendorlib}/Tie -%{perl_vendorarch}/auto/Tie +%files -f %{name}.files +%defattr(-,root,root,755) +%doc CHANGES README %changelog ++++++ Tie-Cache-0.17.tar.gz -> Tie-Cache-0.21.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Cache-0.17/CHANGES new/Tie-Cache-0.21/CHANGES --- old/Tie-Cache-0.17/CHANGES 2002-07-03 09:42:48.000000000 +0200 +++ new/Tie-Cache-0.21/CHANGES 2014-05-19 17:45:20.000000000 +0200 @@ -1,3 +1,14 @@ +$MODULE = "Tie::Cache"; $VERSION = .21; $DATE = '05/19/2014'; + ++ fixed internal $VERSION number + +$MODULE = "Tie::Cache"; $VERSION = .19; $DATE = '02/23/2012'; + ++ added cleaner ref() checking for data size calculations when using a MaxBytes cache, to address bug + https://rt.cpan.org/Public/Bug/Display.html?id=69976 + ++ updated test.pl to "use Tie::Cache" to prevent test conflicts with Cache.pm + $MODULE = "Tie::Cache"; $VERSION = .17; $DATE = '07/03/2002'; + added tied(%cache)->flush() method to sync dirty writes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Cache-0.17/Cache.pm new/Tie-Cache-0.21/Cache.pm --- old/Tie-Cache-0.17/Cache.pm 2002-06-29 00:20:38.000000000 +0200 +++ new/Tie-Cache-0.21/Cache.pm 2014-05-19 17:45:27.000000000 +0200 @@ -7,7 +7,7 @@ $BEFORE $AFTER $KEY $VALUE $BYTES $DIRTY ); -$VERSION = .17; +$VERSION = .21; $Debug = 0; # set to 1 for summary, 2 for debug output $STRUCT_SIZE = 240; # per cached elem bytes overhead, approximate $REF_SIZE = 16; @@ -90,7 +90,9 @@ frequently read from, code like $cache{entry}, which moves the entry to the end of the linked list internally. -=cut Documentation continues at the end of the module. +=cut + +# Documentation continues at the end of the module. sub TIEHASH { my($class, $max_count, $options) = @_; @@ -396,7 +398,7 @@ while(my $elem = shift @data) { next if $refs{$elem}; $refs{$elem} = 1; - if(ref $elem && $elem =~ /(SCALAR|HASH|ARRAY)/) { + if(ref $elem && ref($elem) =~ /^(SCALAR|HASH|ARRAY)$/) { my $type = $1; $length += $REF_SIZE; # guess, 16 bytes per ref, probably more if (($type eq 'SCALAR')) { @@ -592,13 +594,15 @@ Through healthy competition, Michael G Schwern got Tie::Cache::LRU mostly faster than Tie::Cache on reads & writes: - Cache Size 5000 Tie::Cache 0.17 Tie::Cache::LRU 0.21 - 10000 Writes 1.55 CPU sec 1.10 CPU sec - 40000 Reads 1.82 CPU sec 1.58 CPU sec - 10000 Deletes 0.55 CPU sec 0.59 CPU sec + Cache Size 5000 Tie::Cache 0.17 Tie::Cache::LRU 20110205.00 + 10000 Writes 0.63 CPU sec 0.47 CPU sec + 40000 Reads 0.79 CPU sec 0.71 CPU sec + 10000 Deletes 0.23 CPU sec 0.26 CPU sec Unless you are using TRUE CACHE or MaxBytes functionality, -using Tie::Cache::LRU should be an easy replacement for Tie::Cache. +using Tie::Cache::LRU could be an easy replacement for Tie::Cache. + +OTOH one nice thing about this module is its lack of external module dependencies! =head1 TRUE CACHE @@ -676,16 +680,14 @@ =head1 AUTHOR -Please send any questions or comments to Joshua Chamas -at chamas@alumni.stanford.org +Please send any questions or comments to Joshua Chamas at chamas@alumni.stanford.org =head1 COPYRIGHT -Copyright (c) 1999-2002 Joshua Chamas, Chamas Enterprises Inc. -Sponsored by development on NodeWorks http://www.nodeworks.com +Copyright (c) 1999-2012 Joshua Chamas, Chamas Enterprises Inc. +Sponsored by development on NodeWorks http://nodeworks.com and Web Test.org http://web-test.org -All rights reserved. This program is free software; -you can redistribute it and/or modify it under the same +All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Cache-0.17/MANIFEST new/Tie-Cache-0.21/MANIFEST --- old/Tie-Cache-0.17/MANIFEST 2002-06-29 00:22:41.000000000 +0200 +++ new/Tie-Cache-0.21/MANIFEST 2014-05-19 17:45:52.000000000 +0200 @@ -5,5 +5,6 @@ MANIFEST.bak Makefile.PL README -bench.pl +tie-cache-bench.pl test.pl +META.yml Module meta-data (added by MakeMaker) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Cache-0.17/META.yml new/Tie-Cache-0.21/META.yml --- old/Tie-Cache-0.17/META.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/Tie-Cache-0.21/META.yml 2014-05-19 17:45:52.000000000 +0200 @@ -0,0 +1,20 @@ +--- #YAML:1.0 +name: Tie-Cache +version: 0.21 +abstract: ~ +author: [] +license: unknown +distribution_type: module +configure_requires: + ExtUtils::MakeMaker: 0 +build_requires: + ExtUtils::MakeMaker: 0 +requires: {} +no_index: + directory: + - t + - inc +generated_by: ExtUtils::MakeMaker version 6.57_05 +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.4.html + version: 1.4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Cache-0.17/README new/Tie-Cache-0.21/README --- old/Tie-Cache-0.17/README 2002-06-29 00:23:14.000000000 +0200 +++ new/Tie-Cache-0.21/README 2012-02-24 01:48:55.000000000 +0100 @@ -44,26 +44,26 @@ %cache = (); # CLEAR DESCRIPTION - This module implements a least recently used (LRU) cache in memory - through a tie interface. Any time data is stored in the tied hash, that - key/value pair has an entry time associated with it, and as the cache - fills up, those members of the cache that are the oldest are removed to - make room for new entries. - - So, the cache only "remembers" the last written entries, up to the size - of the cache. This can be especially useful if you access great amounts - of data, but only access a minority of the data a majority of the time. - - The implementation is a hash, for quick lookups, overlaying a doubly - linked list for quick insertion and deletion. On a WinNT PII 300, writes - to the hash were done at a rate 3100 per second, and reads from the hash - at 6300 per second. Work has been done to optimize refreshing cache - entries that are frequently read from, code like $cache{entry}, which - moves the entry to the end of the linked list internally. + This module implements a least recently used (LRU) cache in memory through a + tie interface. Any time data is stored in the tied hash, that key/value pair + has an entry time associated with it, and as the cache fills up, those + members of the cache that are the oldest are removed to make room for new + entries. + + So, the cache only "remembers" the last written entries, up to the size of + the cache. This can be especially useful if you access great amounts of + data, but only access a minority of the data a majority of the time. + + The implementation is a hash, for quick lookups, overlaying a doubly linked + list for quick insertion and deletion. On a WinNT PII 300, writes to the + hash were done at a rate 3100 per second, and reads from the hash at 6300 + per second. Work has been done to optimize refreshing cache entries that are + frequently read from, code like $cache{entry}, which moves the entry to the + end of the linked list internally. INSTALLATION - Tie::Cache installs easily using the make or nmake commands as shown - below. Otherwise, just copy Cache.pm to $PERLLIB/site/Tie + Tie::Cache installs easily using the make or nmake commands as shown below. + Otherwise, just copy Cache.pm to $PERLLIB/site/Tie > perl Makefile.PL > make @@ -74,37 +74,38 @@ ** you can also just copy Cache.pm to $perllib/Tie BENCMARKS - There is another simpler LRU cache implementation in CPAN, - Tie::Cache::LRU, which has the same basic size limiting functionality, - and for this functionality, the exact same interface. - - Through healthy competition, Michael G Schwern got Tie::Cache::LRU - mostly faster than Tie::Cache on reads & writes: - - Cache Size 5000 Tie::Cache 0.17 Tie::Cache::LRU 0.21 - 10000 Writes 1.55 CPU sec 1.10 CPU sec - 40000 Reads 1.82 CPU sec 1.58 CPU sec - 10000 Deletes 0.55 CPU sec 0.59 CPU sec + There is another simpler LRU cache implementation in CPAN, Tie::Cache::LRU, + which has the same basic size limiting functionality, and for this + functionality, the exact same interface. + + Through healthy competition, Michael G Schwern got Tie::Cache::LRU mostly + faster than Tie::Cache on reads & writes: + + Cache Size 5000 Tie::Cache 0.17 Tie::Cache::LRU 20110205.00 + 10000 Writes 0.63 CPU sec 0.47 CPU sec + 40000 Reads 0.79 CPU sec 0.71 CPU sec + 10000 Deletes 0.23 CPU sec 0.26 CPU sec Unless you are using TRUE CACHE or MaxBytes functionality, using - Tie::Cache::LRU should be an easy replacement for Tie::Cache. + Tie::Cache::LRU could be an easy replacement for Tie::Cache. + + OTOH one nice thing about this module is its lack of external module + dependencies! TRUE CACHE - To use class as a true cache, which acts as the sole interface for some - data set, subclass the real cache off Tie::Cache, with @ISA = qw( - 'Tie::Cache' ) notation. Then override the read() method for behavior - when there is a cache miss, and the write() method for behavior when the - cache's data changes. - - When WriteSync is 1 or TRUE (DEFAULT), write() is called immediately - when data in the cache is modified. If set to 0, data that has been - modified in the cache gets written out when the entries are deleted or - during the DESTROY phase of the cache object, usually at the end of a - script. + To use class as a true cache, which acts as the sole interface for some data + set, subclass the real cache off Tie::Cache, with @ISA = qw( 'Tie::Cache' ) + notation. Then override the read() method for behavior when there is a cache + miss, and the write() method for behavior when the cache's data changes. + + When WriteSync is 1 or TRUE (DEFAULT), write() is called immediately when + data in the cache is modified. If set to 0, data that has been modified in + the cache gets written out when the entries are deleted or during the + DESTROY phase of the cache object, usually at the end of a script. To have the dirty data write() periodically while WriteSync is set to 0, - there is a flush() cache API call that will flush the dirty writes in - this way. Just call the flush() API like: + there is a flush() cache API call that will flush the dirty writes in this + way. Just call the flush() API like: my $write_flush_count = tied(%cache)->flush(); @@ -164,9 +165,10 @@ chamas@alumni.stanford.org COPYRIGHT - Copyright (c) 1999-2002 Joshua Chamas, Chamas Enterprises Inc. Sponsored - by development on NodeWorks http://www.nodeworks.com + Copyright (c) 1999-2012 Joshua Chamas, Chamas Enterprises Inc. Sponsored by + development on NodeWorks http://nodeworks.com and Web Test.org + http://web-test.org - All rights reserved. This program is free software; you can redistribute - it and/or modify it under the same terms as Perl itself. + All rights reserved. This program is free software; you can redistribute it + and/or modify it under the same terms as Perl itself. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Cache-0.17/bench.pl new/Tie-Cache-0.21/bench.pl --- old/Tie-Cache-0.17/bench.pl 2002-06-29 00:46:27.000000000 +0200 +++ new/Tie-Cache-0.21/bench.pl 1970-01-01 01:00:00.000000000 +0100 @@ -1,64 +0,0 @@ -#!/usr/bin/perl - -use Tie::Cache; -use Tie::Cache::LRU; -use Benchmark; -use strict; - -my $cache_size = 5000; -my $write_count = $cache_size * 2; -my $read_count = $write_count * 4; -my $delete_count = $write_count; - -tie my %cache, 'Tie::Cache', $cache_size; -tie my %cache_lru, 'Tie::Cache::LRU', $cache_size; - -my @cols; -push(@cols, \%cache, \%cache_lru); - -printf " %15s", "Cache Size $cache_size"; -for(@cols) { - my $module = ref(tied(%$_)); - printf " %16s %3.2f", $module, eval "\$$module"."::VERSION"; -} -print "\n"; - -&report("$write_count Writes", sub { - my $cache = shift; - for(1..$write_count) { - $cache->{$_} = $_; - } - }, - @cols, - ); - -&report("$read_count Reads", sub { - my $cache = shift; - for(1..$read_count) { - my $value = $cache->{$_}; - } - }, - @cols, - ); - -&report("$delete_count Deletes", sub { - my $cache = shift; - for(1..$delete_count) { - my $value = $cache->{$_}; - } - }, - @cols, - ); - -sub report { - my($desc, $sub, @caches) = @_; - - printf(" %-15s", $desc); - for my $cache (@caches) { - my $timed = timestr(timeit(1, sub { &$sub($cache) })); - $timed =~ /([\d\.]+\s+cpu)/i; - printf("%18s sec", $1); - } - print "\n"; -} - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Cache-0.17/test.pl new/Tie-Cache-0.21/test.pl --- old/Tie-Cache-0.17/test.pl 2002-06-28 23:52:34.000000000 +0200 +++ new/Tie-Cache-0.21/test.pl 2012-02-24 01:22:03.000000000 +0100 @@ -1,6 +1,6 @@ #!/usr/local/bin/perl -use Cache; +use Tie::Cache; use Benchmark; use vars qw($Size %cache %count_cache); use strict; @@ -132,6 +132,18 @@ sub { keys %cache == $Size - 1 } ); +test("array type insert/read on MaxBytes cache", + sub { $cache{'array'} = ["test"]; $cache{'array'}->[0] eq "test" } + ); +test("string type called ARRAY insert/read on MaxBytes cache", + sub { $cache{'array-fake'} = "ARRAY"; $cache{'array-fake'} eq "ARRAY" } + ); +test("hash type insert/read on MaxBytes cache", + sub { $cache{'array'} = { 'foo' => 'bar' }; $cache{'array'}->{'foo'} eq "bar" } + ); + +exit; + print "\n++++ Stats for %cache\n\n"; my $obj = tied(%cache); print join("\n", map { "$_:\t$obj->{$_}" } 'count', 'hit', 'miss', 'bytes'); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Tie-Cache-0.17/tie-cache-bench.pl new/Tie-Cache-0.21/tie-cache-bench.pl --- old/Tie-Cache-0.17/tie-cache-bench.pl 1970-01-01 01:00:00.000000000 +0100 +++ new/Tie-Cache-0.21/tie-cache-bench.pl 2002-06-29 00:46:27.000000000 +0200 @@ -0,0 +1,64 @@ +#!/usr/bin/perl + +use Tie::Cache; +use Tie::Cache::LRU; +use Benchmark; +use strict; + +my $cache_size = 5000; +my $write_count = $cache_size * 2; +my $read_count = $write_count * 4; +my $delete_count = $write_count; + +tie my %cache, 'Tie::Cache', $cache_size; +tie my %cache_lru, 'Tie::Cache::LRU', $cache_size; + +my @cols; +push(@cols, \%cache, \%cache_lru); + +printf " %15s", "Cache Size $cache_size"; +for(@cols) { + my $module = ref(tied(%$_)); + printf " %16s %3.2f", $module, eval "\$$module"."::VERSION"; +} +print "\n"; + +&report("$write_count Writes", sub { + my $cache = shift; + for(1..$write_count) { + $cache->{$_} = $_; + } + }, + @cols, + ); + +&report("$read_count Reads", sub { + my $cache = shift; + for(1..$read_count) { + my $value = $cache->{$_}; + } + }, + @cols, + ); + +&report("$delete_count Deletes", sub { + my $cache = shift; + for(1..$delete_count) { + my $value = $cache->{$_}; + } + }, + @cols, + ); + +sub report { + my($desc, $sub, @caches) = @_; + + printf(" %-15s", $desc); + for my $cache (@caches) { + my $timed = timestr(timeit(1, sub { &$sub($cache) })); + $timed =~ /([\d\.]+\s+cpu)/i; + printf("%18s sec", $1); + } + print "\n"; +} + -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de