--- lbbs/include/article_cache.h 2025/05/29 09:44:01 1.1 +++ lbbs/include/article_cache.h 2025/11/04 13:49:50 1.9 @@ -1,36 +1,32 @@ -/*************************************************************************** - 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-2025 by Leaflet + */ #ifndef _ARTICLE_CACHE_H_ #define _ARTICLE_CACHE_H_ #include "common.h" -#include "str_process.h" #include "section_list.h" +#include "str_process.h" struct article_cache_t { - void *p_data; + void *p_mmap; + size_t mmap_len; + char *p_data; size_t data_len; long line_total; long line_offsets[MAX_SPLIT_FILE_LINES]; }; typedef struct article_cache_t ARTICLE_CACHE; -extern int article_cache_generate(const char *cache_dir, const ARTICLE *p_article, const char *content); +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);