-
-
25 Nov 2012 14:55:39 UTC
- Distribution: DBIx-DSN-Resolver-Cached
- Module version: 0.04
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Repository
- Issues
- Testers (380 / 0 / 0)
- Kwalitee
Bus factor: 1- 80.49% Coverage
- License: perl_5
- Perl: v5.8.5
- Activity
24 month- Tools
- Download (21.22KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors- Masahiro Nagano <kazeburo {at} gmail.com>
- Dependencies
- Cache::Memory::Simple
- DBIx::DSN::Resolver
- parent
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
DBIx::DSN::Resolver::Cached - Cached resolver for DBIx::DSN::Resolver
SYNOPSIS
use 5.10.0; use DBIx::DSN::Resolver::Cached; sub connect_db { state $resolver = DBIx::DSN::Resolver::Cached->new( ttl => 30, negative_ttl => 5, ); my $dsn = $resolver->resolv('dbi:mysql:database=mytbl;host=myserver.example'); DBI->connect($dsn,'user','password'); }
DESCRIPTION
DBIx::DSN::Resolver::Cached is extension module of DBIx::DSN::Resolver. This module allows CACHE resolver response, useful for reduce load of DNS. DBIx::DSN::Resolver::Cached also supports DNS-RR
OPTIONS
- ttl: Int
-
positive cache ttl in seconds. (default: 5)
- negative_ttl: Int
-
negative cache ttl in seconds. (default: 1)
- cache: Object
-
Cache object, requires support get and set methods. default: Cache::Memory::Simple is used
FUNCTION
- dsn_resolver($dsn: Str)
-
shortcut function for
state $resolver = DBIx::DSN::Resolver::Cached->new(); $resolver->resolv('dbi:mysql:database=mytbl;host=myserver.example')
To customize ttl, negative_ttl and cache object. override $DBIx::DSN::Resolver::Cached::RESOLVER
my $other_ttl = DBIx::DSN::Resolver::Cached->new( ttl => .. ); sub { local $DBIx::DSN::Resolver::Cached::RESOLVER = $other_ttl; dsn_resolver($dsn); }
AUTHOR
Masahiro Nagano <kazeburo {at} gmail.com>
SEE ALSO
DBIx::DSN::Resolver, Cache::Memory::Simple
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Module Install Instructions
To install DBIx::DSN::Resolver::Cached, copy and paste the appropriate command in to your terminal.
cpanm DBIx::DSN::Resolver::Cached
perl -MCPAN -e shell install DBIx::DSN::Resolver::Cached
For more information on module installation, please visit the detailed CPAN module installation guide.