Skip to content

Commit

Permalink
Reduced cache size
Browse files Browse the repository at this point in the history
  • Loading branch information
xfenix committed Apr 21, 2022
1 parent 9c9ba56 commit 8908295
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions envcast/base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""All logic lie here."""
from __future__ import annotations

import abc
import functools
import logging
Expand Down Expand Up @@ -67,9 +66,7 @@ def __call__(
prepared_list = prepared_value.split(one_separator)
break
if not prepared_list:
LOGGER_OBJ.info(
f"Separator for {var_name} is not found. Trying to parse value: {prepared_value}"
)
LOGGER_OBJ.info(f"Separator for {var_name} is not found. Trying to parse value: {prepared_value}")
for one_item in prepared_list:
output_values.append(self.cast_value_to_exact_type(list_type_cast, one_item))
return type_cast(output_values)
Expand Down Expand Up @@ -105,14 +102,12 @@ def set_dotenv_path(
self._path_for_dotenv = pathlib.Path(full_path).resolve()
return self

@functools.lru_cache(maxsize=None)
@functools.lru_cache(maxsize=10)
def _load_dotenv_file(self) -> dict:
"""Small helper for dotenv provider."""
data_provider: dict = {}
try:
statements: list = (
self._path_for_dotenv.read_text(encoding=self._file_encoding).strip().split("\n")
)
statements: list = self._path_for_dotenv.read_text(encoding=self._file_encoding).strip().split("\n")
except IsADirectoryError as exc:
raise exceptions.IncorrectDotenvPath(exc)
for one_row in statements:
Expand Down

0 comments on commit 8908295

Please sign in to comment.