--- lbbs/include/article_cache.h 2025/05/31 02:42:24 1.4 +++ lbbs/include/article_cache.h 2026/01/03 10:27:14 1.12 @@ -1,29 +1,27 @@ -/*************************************************************************** - article_cache.h - description - ------------------- - Copyright : (C) 2004-2025 by Leaflet - Email : leaflet@leafok.com - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 3 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ +/* SPDX-License-Identifier: GPL-3.0-or-later */ +/* + * article_cache + * - convert article content from DB to local cache with LML conversion and line offset index + * + * Copyright (C) 2004-2026 Leaflet + */ #ifndef _ARTICLE_CACHE_H_ #define _ARTICLE_CACHE_H_ #include "common.h" -#include "str_process.h" #include "section_list.h" +#include "str_process.h" + +enum article_cache_constant_t +{ + ARTICLE_CONTENT_MAX_LEN = 1024 * 1024 * 4, // 4MB +}; struct article_cache_t { void *p_mmap; + size_t mmap_len; char *p_data; size_t data_len; long line_total; @@ -31,7 +29,9 @@ struct article_cache_t }; typedef struct article_cache_t ARTICLE_CACHE; -extern int article_cache_generate(const char *cache_dir, const ARTICLE *p_article, const SECTION_LIST *p_section, const char *content, int overwrite); +extern int article_cache_generate(const char *cache_dir, const ARTICLE *p_article, const SECTION_LIST *p_section, + const char *content, const char *sub_ip, int overwrite); +extern void article_cache_cleanup(void); extern int article_cache_load(ARTICLE_CACHE *p_cache, const char *cache_dir, const ARTICLE *p_article); extern int article_cache_unload(ARTICLE_CACHE *p_cache);