michaelesmith/dyndns-processor-cache

a processor for the dyndns-kit framework to allow processors to be cached

0.1.0 2018-11-02 21:43 UTC

This package is auto-updated.

Last update: 2024-11-29 05:44:45 UTC


README

Build Status

What is this?

This is a processor for the dyndns-kit framework to allow other processors to be cached via PSR-6 so that they are only called with new or updated query information. If you don't know what DynDNS-Kit is take a look.

Install

composer require "michaelesmith/dyndns-processor-cache"

You will also need a PSR-6 compatible cache library such as "cache/cache" or "symfony/cache".

How do I use it

To see a full example usage please refer to the example project.

Basic usage

$cacheProcessor = new CacheProcessor(
    new JsonProcessor(__DIR__ . '/var/dns.json'),
    new FilesystemCachePool(
        new \League\Flysystem\Filesystem(
            new \League\Flysystem\Adapter\Local(__DIR__ . '/../var/')
        )
    )
);

This example uses the League Flysystem cache library but any one could be used. In this example only the initial request or one with a new hostname or new ip would fall through to the embedded processor. This is useful for processors that tend to be expensive, especially if the data rarely changes which is usually the case with most DynDNS implementations.

Contributing

Have an idea to make something better? Submit a pull request. PR's make the open source world turn. 🌎 🌏 🌍 :octocat: Happy Coding!