perl-Attribute-Cached-0.02-alt1.noarch.rpm


Advertisement

Description

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 ftp.altlinux.org
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;
}

Alternatives

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

Requires

Name Value
/usr/share/perl5 -
perl(Attribute/Handlers.pm) -
perl(attributes.pm) -
perl(constant.pm) -
rpmlib(PayloadIsLzma) -

Provides

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

Download

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] http://ftp.altlinux.org/pub/distributions/ALTLinux/autoimports/Sisyphus noarch autoimports
    rpm [Sisyphus] http://ftp.altlinux.org/pub/distributions/ALTLinux/autoimports/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

Files

Path
/usr/share/doc/perl-Attribute-Cached-0.02/CHANGES
/usr/share/perl5/Attribute/Cached.pm

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
Advertisement
Advertisement