feat: add full Zonemaster stack with Docker and Spanish UI
- Clone all 5 Zonemaster component repos (LDNS, Engine, CLI, Backend, GUI) - Dockerfile.backend: 8-stage multi-stage build LDNS→Engine→CLI→Backend - Dockerfile.gui: Astro static build served via nginx - docker-compose.yml: backend (internal) + frontend (port 5353) - nginx.conf: root redirects to /es/, /api/ proxied to backend - zonemaster-gui/config.ts: defaultLanguage set to 'es' (Spanish) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
99
zonemaster-engine/lib/Zonemaster/Engine/Nameserver/Cache.pm
Normal file
99
zonemaster-engine/lib/Zonemaster/Engine/Nameserver/Cache.pm
Normal file
@@ -0,0 +1,99 @@
|
||||
package Zonemaster::Engine::Nameserver::Cache;
|
||||
|
||||
use v5.16.0;
|
||||
use warnings;
|
||||
|
||||
use version; our $VERSION = version->declare("v1.0.4");
|
||||
|
||||
use Class::Accessor "antlers";
|
||||
|
||||
our %object_cache;
|
||||
|
||||
has 'data' => ( is => 'ro' );
|
||||
has 'address' => ( is => 'ro' );
|
||||
|
||||
sub get_cache_type {
|
||||
my ( $class, $profile ) = @_;
|
||||
my $cache_type = 'LocalCache';
|
||||
|
||||
my %cache_config = %{ $profile->get( 'cache' ) };
|
||||
|
||||
if ( exists $cache_config{'redis'} ) {
|
||||
$cache_type = 'RedisCache';
|
||||
}
|
||||
|
||||
return $cache_type;
|
||||
}
|
||||
|
||||
sub get_cache_class {
|
||||
my ( $class, $cache_type ) = @_;
|
||||
|
||||
my $cache_class = "Zonemaster::Engine::Nameserver::Cache::$cache_type";
|
||||
|
||||
require ( "$cache_class.pm" =~ s{::}{/}gr );
|
||||
$cache_class->import();
|
||||
|
||||
return $cache_class;
|
||||
}
|
||||
|
||||
sub empty_cache {
|
||||
%object_cache = ();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Zonemaster::Engine::Nameserver::Cache - shared caches for nameserver objects
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
This class should not be used directly.
|
||||
|
||||
=head1 ATTRIBUTES
|
||||
|
||||
=over
|
||||
|
||||
=item address
|
||||
|
||||
A L<Net::IP::XS> object holding the nameserver's address.
|
||||
|
||||
=item data
|
||||
|
||||
A reference to a hash holding the cache of sent queries. Not meant for external use.
|
||||
|
||||
=back
|
||||
|
||||
=head1 CLASS METHODS
|
||||
|
||||
=over
|
||||
|
||||
=item get_cache_type()
|
||||
|
||||
my $cache_type = get_cache_type( Zonemaster::Engine::Profile->effective );
|
||||
|
||||
Get the cache type value from the profile, i.e. the name of the cache module to use.
|
||||
|
||||
Takes a L<Zonemaster::Engine::Profile> object.
|
||||
|
||||
Returns a string.
|
||||
|
||||
=item get_cache_class()
|
||||
|
||||
my $cache_class = get_cache_class( 'LocalCache' );
|
||||
|
||||
Get the cache adapter class for the given database type.
|
||||
|
||||
Takes a string (cache database type).
|
||||
|
||||
Returns a string, or throws an exception if the cache adapter class cannot be loaded.
|
||||
|
||||
=item empty_cache()
|
||||
|
||||
Clear the cache.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
Reference in New Issue
Block a user