perl-Attribute-Cached - easily cache subroutines results using a :Cached attribute

Property Value
Distribution ALT Linux Sisyphus
Repository Autoimports noarch
Package name perl-Attribute-Cached
Package version 0.02
Package release alt1
Package architecture noarch
Package type rpm
Installed size 8.99 KB
Download size 8.99 KB
Official Mirror
In many applications, including web apps, caching data is used to help scale
the sites, trading a slight lack of immediacy in results with a lower load on
DB and other resources.
Usually we'll do something like this
sub my_query {
my ($self, %pars) = @_;
my $cache = $self->get_cache;
my $key = $self->get_key( %pars );
my $result;
if ($result = $cache->get($key)) {
warn "Cache hit for $key";
return $result;
$result = $self->expensive_operation;
$cache->set($key, $result, 20); # hard code a cache time here
return $result;
The caching logic is repeated boilerplate and, worse, really has nothing
to do with what we're trying to achieve here.  With the Attribute::Cached manpage
we'd write this as:
sub getCache { my $self = shift; return $self->get_cache(@_) }
sub my_query :Cached(time=>20, key=>\&get_key) {
my $result = $self->expensive_operation;
return $result;


Package Version Architecture Repository
perl-Attribute-Cached - - -


Name Value
/usr/share/perl5 -
perl(Attribute/ -
perl( -
perl( -
rpmlib(PayloadIsLzma) -


Name Value
perl(Attribute/ = 0.020
perl-Attribute-Cached = 0.02-alt1


Type URL
Binary Package perl-Attribute-Cached-0.02-alt1.noarch.rpm
Source Package perl-Attribute-Cached-0.02-alt1.src.rpm

Install Howto

  1. Add the following line to /etc/apt/sources.list:
    rpm [Sisyphus] noarch autoimports
    rpm [Sisyphus] noarch autoimports
  2. Update the package index:
    # sudo apt-get update
  3. Install perl-Attribute-Cached rpm package:
    # sudo apt-get install perl-Attribute-Cached



See Also

Package Description
perl-Attribute-Constructor-0.04-alt1.noarch.rpm perl module Attribute-Constructor
perl-Attribute-Context-0.042-alt1.noarch.rpm Perl extension for automatically altering subroutine behavior
perl-Attribute-Curried-0.02-alt1.noarch.rpm perl module Attribute-Curried
perl-Attribute-Default-1.35-alt1.noarch.rpm Perl extension to assign default values to subroutine arguments
perl-Attribute-Deprecated-1.04-alt1.noarch.rpm perl module Attribute-Deprecated
perl-Attribute-Exporter-0.01-alt1.noarch.rpm perl module Attribute-Exporter
perl-Attribute-Final-1.3-alt1.noarch.rpm perl module Attribute-Final
perl-Attribute-Generator-0.02-alt1.noarch.rpm Python like generator powered by Coro
perl-Attribute-GlobalEnable-0.01-alt1.noarch.rpm perl module Attribute-GlobalEnable
perl-Attribute-Handlers-Prospective-0.01-alt1.noarch.rpm perl module Attribute-Handlers-Prospective
perl-Attribute-Lexical-0.005-alt1.noarch.rpm sane scoping of function/variable attributes
perl-Attribute-Method-Tags-0.11-alt1.noarch.rpm Attribute interface for adding tags to methods
perl-Attribute-Overload-1.100710-alt1.noarch.rpm Attribute that makes overloading easier
perl-Attribute-Overload-Match-0.01-alt1.noarch.rpm perl module Attribute-Overload-Match
perl-Attribute-Params-Validate-1.21-alt1.noarch.rpm Define validation through subroutine attributes