1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* camel-data-cache.h: Class for a Camel filesystem cache
4 * Authors: Michael Zucchi <notzed@ximian.com>
6 * Copyright (C) 2001 Ximian, Inc. (www.ximian.com)
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU Lesser General Public
10 * License as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
24 #ifndef CAMEL_DATA_CACHE_H
25 #define CAMEL_DATA_CACHE_H 1
29 #include <camel/camel-stream.h>
30 #include <camel/camel-exception.h>
32 #define CAMEL_DATA_CACHE_TYPE (camel_data_cache_get_type ())
33 #define CAMEL_DATA_CACHE(obj) (CAMEL_CHECK_CAST((obj), CAMEL_DATA_CACHE_TYPE, CamelFolder))
34 #define CAMEL_DATA_CACHE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_DATA_CACHE_TYPE, CamelFolderClass))
35 #define CAMEL_IS_DATA_CACHE(o) (CAMEL_CHECK_TYPE((o), CAMEL_DATA_CACHE_TYPE))
39 typedef struct _CamelDataCache CamelDataCache;
40 typedef struct _CamelDataCacheClass CamelDataCacheClass;
42 struct _CamelDataCache {
43 CamelObject parent_object;
45 struct _CamelDataCachePrivate *priv;
54 struct _CamelDataCacheClass {
55 CamelObjectClass parent_class;
57 /* None are virtual yet */
60 CamelStream *(*add)(CamelDataCache *cmc, const char *path, const char *key, CamelException *ex);
61 CamelStream *(*get)(CamelDataCache *cmc, const char *path, const char *key, CamelException *ex);
62 int (*close)(CamelDataCache *cmc, CamelStream *stream, CamelException *ex);
63 int (*remove)(CamelDataCache *cmc, const char *path, const char *key, CamelException *ex);
65 int (*clear)(CamelDataCache *cmc, const char *path, CamelException *ex);
70 CamelDataCache *camel_data_cache_new(const char *path, guint32 flags, CamelException *ex);
72 void camel_data_cache_set_expire_age(CamelDataCache *cache, time_t when);
73 void camel_data_cache_set_expire_access(CamelDataCache *cdc, time_t when);
75 int camel_data_cache_rename(CamelDataCache *cache,
76 const char *old, const char *new, CamelException *ex);
78 CamelStream *camel_data_cache_add(CamelDataCache *cache,
79 const char *path, const char *key, CamelException *ex);
80 CamelStream *camel_data_cache_get(CamelDataCache *cache,
81 const char *path, const char *key, CamelException *ex);
82 int camel_data_cache_remove(CamelDataCache *cache,
83 const char *path, const char *key, CamelException *ex);
85 int camel_data_cache_clear(CamelDataCache *cache,
86 const char *path, CamelException *ex);
88 /* Standard Camel function */
89 CamelType camel_data_cache_get_type (void);
93 #endif /* CAMEL_DATA_CACHE_H */