summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite/cache.h
diff options
context:
space:
mode:
authorGerhard Häring <gh@ghaering.de>2006-04-23 15:24:26 (GMT)
committerGerhard Häring <gh@ghaering.de>2006-04-23 15:24:26 (GMT)
commit3e99c0ad649de0393d9a8af17f34d9d1f55f4ab2 (patch)
treeeccb1576b1380f17d880133f1fbf92df8456295d /Modules/_sqlite/cache.h
parent5ef9d9fdb93cd5bd5179d8ce63c28248a4614d44 (diff)
downloadcpython-3e99c0ad649de0393d9a8af17f34d9d1f55f4ab2.zip
cpython-3e99c0ad649de0393d9a8af17f34d9d1f55f4ab2.tar.gz
cpython-3e99c0ad649de0393d9a8af17f34d9d1f55f4ab2.tar.bz2
Updated the sqlite3 module to the external pysqlite 2.2.2 version.
Diffstat (limited to 'Modules/_sqlite/cache.h')
-rw-r--r--Modules/_sqlite/cache.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/Modules/_sqlite/cache.h b/Modules/_sqlite/cache.h
index 5cc16f3..1f13907 100644
--- a/Modules/_sqlite/cache.h
+++ b/Modules/_sqlite/cache.h
@@ -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 @@ typedef struct
{
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;