Giter VIP home page Giter VIP logo

io-async-resolver-stupidcache's Introduction

NAME
    `IO::Async::Resolver::StupidCache' - a trivial caching layer around an
    `IO::Async::Resolver'

SYNOPSIS
     use IO::Async::Loop 0.62;
     use IO::Async::Resolver::StupidCache;

     my $loop = IO::Async::Loop->new;

     # Wrap the existing resolver in a cache
     $loop->set_resolver(
        IO::Async::Resolver::StupidCache->new( source => $loop->resolver )
     );

     # $loop->resolve requests will now be cached

DESCRIPTION
    This object class provides a wrapper around another IO::Async::Resolver
    instance, which applies a simple caching layer to avoid making identical
    lookups. This can be useful, for example, when performing a large number
    of HTTP requests to the same host or a small set of hosts, or other
    cases where it is expected that the same few resolver queries will be
    made over and over.

    This is called a "stupid" cache because it is made without awareness of
    TTL values or other cache-relevant information that may be provided by
    DNS or other resolve methods. As such, it should not be relied upon to
    give always-accurate answers.

PARAMETERS
    The following named parameters may be passed to `new' or `configure':

    source => IO::Async::Resolver
            Optional. The source of the cache data. If not supplied, a new
            `IO::Async::Resolver' instance will be constructed.

    ttl => INT
            Optional. Time-to-live of cache entries in seconds. If not
            supplied a default of 5 minutes will apply.

    max_size => INT
            Optional. Maximum number of entries to keep in the cache.
            Entries will be evicted at random over this limit. If not
            supplied a default of 1000 entries will apply.

METHODS
  $resolver = $cache->source
    Returns the source resolver

  $cache->resolve( %args ) ==> ( @result )
  $cache->getaddrinfo( %args ) ==> ( @addrs )
  $cache->getnameinfo( %args ) ==> ( $host, $service )
    These methods perform identically to the base `IO::Async::Resolver'
    class, except that the results are cached.

AUTHOR
    Paul Evans <[email protected]>

io-async-resolver-stupidcache's People

Contributors

leonerd avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.