2022-09-08 01:08:37 +00:00
|
|
|
from core.base.aiobrowser import AioBrowser
|
|
|
|
from core.service import init_service
|
2022-10-12 13:39:47 +00:00
|
|
|
from core.base.redisdb import RedisDB
|
|
|
|
from core.template.services import TemplateService
|
2022-10-22 07:03:59 +00:00
|
|
|
from core.template.cache import TemplatePreviewCache, HtmlToFileIdCache
|
|
|
|
|
2022-07-26 10:07:31 +00:00
|
|
|
|
2022-09-08 01:08:37 +00:00
|
|
|
@init_service
|
2022-10-12 13:39:47 +00:00
|
|
|
def create_template_service(browser: AioBrowser, redis: RedisDB):
|
2022-10-22 07:03:59 +00:00
|
|
|
_preview_cache = TemplatePreviewCache(redis)
|
|
|
|
_html_to_file_id_cache = HtmlToFileIdCache(redis)
|
|
|
|
_service = TemplateService(browser, _html_to_file_id_cache, _preview_cache)
|
2022-07-26 10:07:31 +00:00
|
|
|
return _service
|