2 * Unix SMB/CIFS implementation.
4 * Generic, persistent and shared between processes cache mechanism for use
5 * by various parts of the Samba code
7 * Copyright (C) Rafal Szczesniak 2002
8 * Copyright (C) Volker Lendecke 2009
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #ifndef __LIB_GENCACHE_H__
25 #define __LIB_GENCACHE_H__
28 #include "system/time.h"
29 #include "lib/util/data_blob.h"
31 bool gencache_set(const char *keystr
, const char *value
, time_t timeout
);
32 bool gencache_del(const char *keystr
);
33 bool gencache_get(const char *keystr
, TALLOC_CTX
*mem_ctx
, char **value
,
35 bool gencache_parse(const char *keystr
,
36 void (*parser
)(time_t timeout
, DATA_BLOB blob
,
39 bool gencache_get_data_blob(const char *keystr
, TALLOC_CTX
*mem_ctx
,
41 time_t *timeout
, bool *was_expired
);
42 bool gencache_stabilize(void);
43 bool gencache_set_data_blob(const char *keystr
, const DATA_BLOB
*blob
,
45 void gencache_iterate_blobs(void (*fn
)(const char *key
, DATA_BLOB value
,
46 time_t timeout
, void *private_data
),
47 void *private_data
, const char *pattern
);
48 void gencache_iterate(void (*fn
)(const char* key
, const char *value
,
49 time_t timeout
, void* dptr
),
50 void* data
, const char* keystr_pattern
);