Debian Codegraph @

lib/grn_cache.h

raw symbols SCIP
1 /*
2 Copyright (C) 2009-2016 Brazil
3 Copyright (C) 2022 Sutou Kouhei <[email protected]>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 #pragma once
21
22 #include "grn.h"
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 #define GRN_CACHE_MAX_KEY_SIZE GRN_HASH_MAX_KEY_SIZE_LARGE
29
30 typedef struct {
31 uint32_t nentries;
32 uint32_t max_nentries;
33 uint32_t nfetches;
34 uint32_t nhits;
35 } grn_cache_statistics;
36
37 void grn_cache_init(void);
38 grn_rc grn_cache_fetch(grn_ctx *ctx, grn_cache *cache,
39 const char *str, uint32_t str_size,
40 grn_obj *output);
41 void grn_cache_update(grn_ctx *ctx, grn_cache *cache,
42 const char *str, uint32_t str_size, grn_obj *value);
43 void grn_cache_expire(grn_cache *cache, uint32_t size);
44 void grn_cache_fin(void);
45 void grn_cache_get_statistics(grn_ctx *ctx, grn_cache *cache,
46 grn_cache_statistics *statistics);
47
48 #ifdef __cplusplus
49 }
50 #endif