class_docstr: Base class for caching in database.
  Includes low-level idea of caching data using relational database.
  
  :param main_table: table to store into or load from
  :param cache_dir: path to the place where cache files should be stored.
  :param use_stats: bool indicating if it is needed to use cache performance dict
  :param stats_keys: sequence of keys for supporting cache effectiveness
class_docstr_tok: ["Base","class","for","caching","in","database",".","Includes","low-level","idea","of","caching","data","using","relational","database",".",":","param","main_table",":","table","to","store","into","or","load","from",":","param","cache_dir",":","path","to","the","place","where","cache","files","should","be","stored",".",":","param","use_stats",":","bool","indicating","if","it","is","needed","to","use","cache","performance","dict",":","param","stats_keys",":","sequence","of","keys","for","supporting","cache","effectiveness"]
code: def __init__(
      self,
      main_table: str = "default",
      cache_dir: Optional[str] = None,
      use_stats: bool = False,
      stats_keys: Sequence = ("default_hit", "default_total"),
  ):
      self._main_table = main_table
      self._db_suffix = f".{main_table}_db"
      if cache_dir is None or Path(cache_dir).samefile(
          default_fedot_data_dir()
      ):
          self.db_path = Path(default_fedot_data_dir())
          self._del_prev_temps()
      else:
          self.db_path = Path(cache_dir)
      self.db_path = self.db_path.joinpath(
          f"cache_{os.getpid()}"
      ).with_suffix(self._db_suffix)
  
      self._eff_table = "effectiveness"
      self.use_stats = use_stats
      self._effectiveness_keys = stats_keys
      self._init_eff()
  
file_path: FEDOT/fedot/core/caching/base_cache_db.py
imports: import os
  import sqlite3
  from contextlib import closing
  from pathlib import Path
  from typing import Optional, Sequence, Tuple
  import psutil
  from fedot.core.utils import default_fedot_data_dir
label_desc: Use image node_id 1 to create a new BaseCacheDB object  with example: obj = BaseCacheDB(main_table, cache_dir, use_stats, stats_keys)