docstr: name_space: train, valid, test
  database: database to use
  table: which table
  columns: selected cols
  max_size: max batches to cache
docstr_tok: ["name_space",":","train",",","valid",",","test","database",":","database","to","use","table",":","which","table","columns",":","selected","cols","max_size",":","max","batches","to","cache"]
code: def __init__(
      self,
      name_space: str,
      database: str,
      table: str,
      columns: List,
      batch_size: int,
      max_size: int = CACHE_SIZE,
  ):
      """
      name_space: train, valid, test
      database: database to use
      table: which table
      columns: selected cols
      max_size: max batches to cache
      """
      self.name_space = name_space
      self.batch_size = batch_size
      self.last_id = -1
      self.database = database
      self.table = table
      self.columns = columns
      self.queue = queue.Queue(maxsize=max_size)
      self.thread = threading.Thread(
          target=self.fetch_data, daemon=True
      )
      self.thread.start()
  
file_path: singa/examples/model_selection/TRAILS-Database-Native-Model-Selection/internal/cache-service/cache_service.py
imports: import time
  import threading
  import queue
  import psycopg2
  from typing import Any, List, Dict, Tuple
  from sanic import Sanic
  from sanic.response import json
  import calendar
  import os
  import logging
label_desc: Use image node_id 1 to create a new CacheService object  with example: obj = CacheService(name_space, database, table, columns, batch_size, max_size)