OSSP CVS Repository

ossp - Difference in ossp-pkg/cache/cache.c versions 1.1 and 1.2
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/cache/cache.c 1.1 -> 1.2

--- cache.c      2002/01/09 10:44:28     1.1
+++ cache.c      2002/02/16 12:57:57     1.2
@@ -47,3 +47,60 @@
 #define TRUE  (!FALSE)
 #endif
 
+/* forward declarations */
+struct cache_st;
+struct cache_obj_st;
+
+/* type definitions */
+typedef struct cache_obj_st  cache_obj_t;
+
+/* support for relative pointers (offset pointers) */
+typedef long op_t;
+#define VP2OP(bp,vp) \
+    (long)(((char *)(vp))-((char *)(bp)))
+#define OP2VP(bp,op) \
+    (void *)(((char *)(bp))+((char *)(op)))
+
+/* definition: top-level cache structure */
+struct cache_st {
+    /* top level access pointers */
+    op_t             opHash;        /* pointer to hash table */
+    op_t             opObjMRU;      /* pointer to MRU object */
+    op_t             opObjLRU;      /* pointer to LRU object */
+    op_t             opObjEmpty;    /* pointer to empty object */
+
+    /* information */
+    int              bExpireReset;  /* whether expire resets on each access or is absolute */
+    int              tExpireReset;  /* the optional expire reset time */
+
+    /* sub-structure information */
+    op_t             opKeyIndex;    /* base address of key bucket index */
+    op_t             opKeyBuckets;  /* base address of key bucket pool */
+    int              nKeyBuckets;   /* number of buckets in key bucket pool */
+    op_t             opValIndex;    /* base address of key bucket index */
+    op_t             opValBuckets;  /* base address of value bucket pool */
+    int              nValBuckets;   /* number of buckets in value bucket pool */
+
+    /* statistics */
+    long             nInserts;
+    long             nLookups;
+    long             nLookupsSuccess;
+    long             nRemoves;
+
+    /* callbacks */
+    /* ... */
+};
+
+/* definition: cache object */
+struct cache_obj_st {
+    int              bUsed;        /* used in an ongoing iteration */
+    op_t             opHashNext;   /* next object in hash table collision chain */
+    op_t             opQueuePrev;  /* previous object in LRU queue */
+    op_t             opQueueNext;  /* next object in LRU queue */
+    op_t             opKey;        /* pointer to first key segment in key index */
+    size_t           nKey;         /* size of key in bytes */
+    op_t             opVal;        /* pointer to first value segment in value index */
+    size_t           nVal;         /* size of value in bytes */
+    time_t           tExpire;      /* expire time of object */
+};
+

CVSTrac 2.0.1