[Slim-Checkins] r10932 - /trunk/server/Slim/Schema/Track.pm
adrian at svn.slimdevices.com
adrian at svn.slimdevices.com
Sun Dec 10 09:04:00 PST 2006
Author: adrian
Date: Sun Dec 10 09:04:00 2006
New Revision: 10932
URL: http://svn.slimdevices.com?rev=10932&view=rev
Log:
Bug: N/A
Description: cache track->artistsWithAttributes as it is expensive,
speeds up TT processing for repeated artistAsText and artistAsHTML
Modified:
trunk/server/Slim/Schema/Track.pm
Modified: trunk/server/Slim/Schema/Track.pm
URL: http://svn.slimdevices.com/trunk/server/Slim/Schema/Track.pm?rev=10932&r1=10931&r2=10932&view=diff
==============================================================================
--- trunk/server/Slim/Schema/Track.pm (original)
+++ trunk/server/Slim/Schema/Track.pm Sun Dec 10 09:04:00 2006
@@ -43,6 +43,9 @@
}
$class->resultset_class('Slim::Schema::ResultSet::Track');
+
+ # Simple caching as artistsWithAttributes is expensive.
+ $class->mk_group_accessors('simple' => 'cachedArtistsWithAttributes');
}
# Wrappers - to make sure that the UTF-8 code is called. I really just want to
@@ -103,6 +106,10 @@
sub artistsWithAttributes {
my $self = shift;
+
+ if ($self->cachedArtistsWithAttributes) {
+ return $self->cachedArtistsWithAttributes;
+ }
my @objs = ();
@@ -120,6 +127,8 @@
}
}
+ $self->cachedArtistsWithAttributes(\@objs);
+
return \@objs;
}
More information about the checkins
mailing list