def __post_init__(self) -> None:
    if (self.db is not None):
        self.db.isolation_level = None
        self.db.execute(dedent(f'''
                CREATE TABLE IF NOT EXISTS `{self.table_name}` (
                  k TEXT PRIMARY KEY,
                  t0 FLOAT,
                  t FLOAT,
                  v TEXT NOT NULL
                )
            '''))
        if self.duration:
            self.db.execute(dedent(f'''
                    DELETE FROM `{self.table_name}`
                    WHERE t0 < {(time() - self.duration.total_seconds())}
                '''))
        if self.size:
            res = self.db.execute(f'SELECT t FROM `{self.table_name}` ORDER BY t DESC LIMIT {self.size}').fetchall()
            if res:
                (min_t,) = res[(- 1)]
                self.db.execute(f'DELETE FROM `{self.table_name}` WHERE t < {min_t}')
        for (k, t0, t, v) in self.db.execute(f'SELECT k, t0, t, v FROM `{self.table_name}` ORDER BY t').fetchall():
            memo = self.make_memo(t0=t0)
            memo.memo_return_state.called = True
            memo.memo_return_state.value = self.pickler.loads(v)
            self.memos[k] = memo
        if self.duration:
            for (k, t0) in self.db.execute(f'SELECT k, t0 FROM `{self.table_name}` ORDER BY t0').fetchall():
                self.expire_order[k] = ...
def __post_init__(self) -> None:
    if (self.db is not None):
        self.db.isolation_level = None
        self.db.execute(dedent(f'
                CREATE TABLE IF NOT EXISTS `{self.table_name}` (
                  k TEXT PRIMARY KEY,
                  t0 FLOAT,
                  t FLOAT,
                  v TEXT NOT NULL
                )
            '))
        if self.duration:
            self.db.execute(dedent(f'
                    DELETE FROM `{self.table_name}`
                    WHERE t0 < {(time() - self.duration.total_seconds())}
                '))
        if self.size:
            res = self.db.execute(f'SELECT t FROM `{self.table_name}` ORDER BY t DESC LIMIT {self.size}').fetchall()
            if res:
                (min_t,) = res[(- 1)]
                self.db.execute(f'DELETE FROM `{self.table_name}` WHERE t < {min_t}')
        for (k, t0, t, v) in self.db.execute(f'SELECT k, t0, t, v FROM `{self.table_name}` ORDER BY t').fetchall():
            memo = self.make_memo(t0=t0)
            memo.memo_return_state.called = True
            memo.memo_return_state.value = self.pickler.loads(v)
            self.memos[k] = memo
        if self.duration:
            for (k, t0) in self.db.execute(f'SELECT k, t0 FROM `{self.table_name}` ORDER BY t0').fetchall():
                self.expire_order[k] = ...