--- cache.h 2002/01/09 10:44:28 1.1
+++ cache.h 2002/02/16 12:57:58 1.2
@@ -31,5 +31,58 @@
#ifndef __CACHE_H__
#define __CACHE_H__
+struct cache_st;
+typedef cache_st cache_t;
+
+typedef enum {
+ CACHE_OK = 0,
+ CACHE_ERR_INVAL,
+ CACHE_ERR_SYS
+} cache_rc_t;
+
+typedef enum {
+ CACHE_SET,
+ CACHE_GET,
+} cache_config_t;
+
+typedef enum {
+ CACHE_ST_MAXKEY,
+ CACHE_CB_MUTEXACQUIRE,
+ CACHE_CB_MUTEXRELEASE,
+ CACHE_CB_OBJECTREMOVE,
+} cache_param_t;
+
+typedef enum {
+ CACHE_INPLACE, /* re-arrange segments internally */
+ CACHE_COPYOUT, /* copy as serialized object into new buffer */
+ CACHE_MOVEOUT, /* move as serialized object into existing buffer */
+} cache_fetch_t;
+
+typedef struct {
+ void *ptr;
+ size_t len;
+} cache_blob_t;
+
+cache_rc_t cache_attach (cache_t **cache, void *memptr, size_t memlen, size_t keyseg, size_t valseg);
+cache_rc_t cache_config (cache_t *cache, cache_config_t mode, cache_param_t id, ...);
+cache_rc_t cache_detach (cache_t *cache);
+
+cache_rc_t cache_insert (cache_t *cache, cache_blob_t key, cache_blob_t val, time_t now, time_t expire);
+cache_rc_t cache_lookup (cache_t *cache, cache_blob_t key, cache_obj_t **obj, time_t now);
+cache_rc_t cache_remove (cache_t *cache, cache_blob_t key);
+
+cache_rc_t cache_obj_size (cache_obj_t *obj, size_t *size);
+cache_rc_t cache_obj_fetch (cache_obj_t *obj, cache_fetch_t mode, cache_blob_t *val);
+cache_rc_t cache_obj_release (cache_obj_t *obj);
+
+cache_rc_t cache_fetch (cache_t *cache, cache_iter_t *iter, cache_blob_t *val);
+
+cache_rc_t cache_iter_create (cache_t *cache, cache_iter_t *iter);
+cache_rc_t cache_iter_key (cache_t *cache, cache_iter_t *iter);
+cache_rc_t cache_iter_destroy(cache_t *cache, cache_iter_t *iter);
+
+cache_rc_t cache_export (cache_t *cache, void *);
+cache_rc_t cache_import (cache_t *cache, void *);
+
#endif /* __CACHE_H__ */
|