<?php

declare(strict_types=1);

\main_tts\registry::get('di')->register('cache', function(array $args) {
  $servers = \main_tts\configure::get('cache', 'servers');

  if (isset($args[0])) {
    $db_no = $args[0];
  } else {
    \main_tts\configure::get('cache', 'selected_db_no');
  }

  $auth = \main_tts\configure::get('cache', 'auth_password');
  return new \tts\services\cache\redis_db($servers, $db_no, $auth);
});
