From 65dfa736f4157ae303c34fd6e836c8d354e1952b Mon Sep 17 00:00:00 2001 From: Philippe Pittoli Date: Sun, 15 Dec 2024 01:30:25 +0100 Subject: [PATCH] From `Cached` to `Common` database for a very quick start-up phase. --- src/storage.cr | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/storage.cr b/src/storage.cr index 133ea6c..ef838a8 100644 --- a/src/storage.cr +++ b/src/storage.cr @@ -7,16 +7,16 @@ require "./service.cr" require "dodb" class DNSManager::Storage - getter domains : DODB::Storage::Cached(Domain) + getter domains : DODB::Storage::Common(Domain) getter domains_by_name : DODB::Trigger::IndexCached(Domain) getter domains_by_share_key : DODB::Trigger::IndexCached(Domain) getter domains_by_transfer_key : DODB::Trigger::IndexCached(Domain) getter domains_by_owners : DODB::Trigger::Tags(Domain) - getter zones : DODB::Storage::Cached(Zone) + getter zones : DODB::Storage::Common(Zone) getter zones_by_domain : DODB::Trigger::IndexCached(Zone) - getter tokens : DODB::Storage::Cached(Token) + getter tokens : DODB::Storage::Common(Token) getter tokens_by_uuid : DODB::Trigger::IndexCached(Token) getter tokens_by_domain : DODB::Trigger::Partition(Token) @@ -32,7 +32,7 @@ class DNSManager::Storage end def initialize(@root : String, reindex : Bool = false) - @domains = DODB::Storage::Cached(Domain).new "#{@root}/domains" + @domains = DODB::Storage::Common(Domain).new "#{@root}/domains", 5_000 @domains_by_name = @domains.new_index "name", &.name @domains_by_share_key = @domains.new_index "share-key", do |d| if k = d.share_key @@ -49,9 +49,9 @@ class DNSManager::Storage end end @domains_by_owners = @domains.new_tags "owners", &.owners.map &.to_s - @zones = DODB::Storage::Cached(Zone).new "#{@root}/zones" + @zones = DODB::Storage::Common(Zone).new "#{@root}/zones", 5_000 @zones_by_domain = @zones.new_index "domain", &.domain - @tokens = DODB::Storage::Cached(Token).new "#{@root}/tokens" + @tokens = DODB::Storage::Common(Token).new "#{@root}/tokens", 5_000 @tokens_by_uuid = @tokens.new_index "uuid", &.uuid @tokens_by_domain = @tokens.new_partition "domain", &.domain