Migrated to new libraries
This commit is contained in:
+6
-6
@@ -12,10 +12,10 @@ from pydantic import BaseModel, Field
|
||||
import json
|
||||
import time
|
||||
import argparse
|
||||
import simple_cache
|
||||
import jcloud_cachelib
|
||||
import ipaddress
|
||||
import pathlib
|
||||
import config_parser
|
||||
import jcloud_config_parser
|
||||
from typing import Any, Dict
|
||||
from types import FunctionType
|
||||
import threading
|
||||
@@ -52,12 +52,12 @@ args = argument_parser.parse_args()
|
||||
|
||||
# load default configuration
|
||||
with open(os.path.dirname(__file__) + '/../default_configuration.conf') as f:
|
||||
default_configuration = config_parser.ini.INIConfiguration.from_string(f.read())
|
||||
default_configuration = jcloud_config_parser.ini.INIConfiguration.from_string(f.read())
|
||||
f.close()
|
||||
|
||||
# load configuration
|
||||
with open(args.config) as f:
|
||||
configuration = config_parser.ini.INIConfiguration.from_string(f.read(), default=default_configuration, ignore_errors=True)
|
||||
configuration = jcloud_config_parser.ini.INIConfiguration.from_string(f.read(), default=default_configuration, ignore_errors=True)
|
||||
f.close()
|
||||
|
||||
logfile = configuration.logging.logfile
|
||||
@@ -200,7 +200,7 @@ class DisabledCache:
|
||||
def __init__(self, generate_value_func: FunctionType, max_size: int = 256, ttl: int = 120) -> None:
|
||||
'''
|
||||
The cache class for disabling the cache, but compatible with
|
||||
simple_cache.Cache.
|
||||
jcloud_cachelib.Cache.
|
||||
It always calls the function to generate a value when a value is
|
||||
retrieved from the cache. No data is cached and the methods for storing
|
||||
data to the cache or delete data from it do nothing.
|
||||
@@ -350,7 +350,7 @@ cache_enabled = cache_enabled.lower() == 'true'
|
||||
|
||||
if cache_enabled:
|
||||
# cache is enabled
|
||||
cache = simple_cache.Cache(
|
||||
cache = jcloud_cachelib.Cache(
|
||||
generate_value_func = predict_language_wrapper,
|
||||
max_size=cache_max_size,
|
||||
ttl=cache_ttl
|
||||
|
||||
Reference in New Issue
Block a user