diff Modules/_sqlite/cache.h @ 37938:7da4af95ebad legacy-trunk

Updated the sqlite3 module to the external pysqlite 2.2.2 version.
author Gerhard Häring <gh@ghaering.de>
date Sun, 23 Apr 2006 15:24:26 +0000
parents e546274d6503
children b9d4ced23506
line wrap: on
line diff
--- a/Modules/_sqlite/cache.h	Sun Apr 23 15:14:37 2006 +0000
+++ b/Modules/_sqlite/cache.h	Sun Apr 23 15:24:26 2006 +0000
@@ -1,6 +1,6 @@
 /* cache.h - definitions for the LRU cache
  *
- * Copyright (C) 2004-2005 Gerhard Häring <gh@ghaering.de>
+ * Copyright (C) 2004-2006 Gerhard Häring <gh@ghaering.de>
  *
  * This file is part of pysqlite.
  *
@@ -25,6 +25,10 @@
 #define PYSQLITE_CACHE_H
 #include "Python.h"
 
+/* The LRU cache is implemented as a combination of a doubly-linked with a
+ * dictionary. The list items are of type 'Node' and the dictionary has the
+ * nodes as values. */
+
 typedef struct _Node
 {
     PyObject_HEAD
@@ -39,10 +43,18 @@
 {
     PyObject_HEAD
     int size;
+
+    /* a dictionary mapping keys to Node entries */
     PyObject* mapping;
+
+    /* the factory callable */
     PyObject* factory;
+
     Node* first;
     Node* last;
+
+    /* if set, decrement the factory function when the Cache is deallocated.
+     * this is almost always desirable, but not in the pysqlite context */
     int decref_factory;
 } Cache;