aboutsummaryrefslogtreecommitdiff
path: root/src/include/utils/syscache.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-11-16 22:30:52 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-11-16 22:30:52 +0000
commita933ee38bbb8dffbc48a3363a94ff6f2a9f7964d (patch)
tree1c32737389b2530e7152dc2287161b36d9001e8c /src/include/utils/syscache.h
parentcff23842a4c68301ddf34559c7af383bb5557054 (diff)
downloadpostgresql-a933ee38bbb8dffbc48a3363a94ff6f2a9f7964d.tar.gz
postgresql-a933ee38bbb8dffbc48a3363a94ff6f2a9f7964d.zip
Change SearchSysCache coding conventions so that a reference count is
maintained for each cache entry. A cache entry will not be freed until the matching ReleaseSysCache call has been executed. This eliminates worries about cache entries getting dropped while still in use. See my posting to pg-hackers of even date for more info.
Diffstat (limited to 'src/include/utils/syscache.h')
-rw-r--r--src/include/utils/syscache.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/include/utils/syscache.h b/src/include/utils/syscache.h
index 5d17e8db44c..73abd53e134 100644
--- a/src/include/utils/syscache.h
+++ b/src/include/utils/syscache.h
@@ -9,7 +9,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: syscache.h,v 1.26 2000/06/17 04:56:29 tgl Exp $
+ * $Id: syscache.h,v 1.27 2000/11/16 22:30:49 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -57,12 +57,22 @@
#define TYPENAME 26
#define TYPEOID 27
-extern void zerocaches(void);
extern void InitCatalogCache(void);
-extern HeapTuple SearchSysCacheTuple(int cacheId,
+
+extern HeapTuple SearchSysCache(int cacheId,
+ Datum key1, Datum key2, Datum key3, Datum key4);
+extern void ReleaseSysCache(HeapTuple tuple);
+
+/* convenience routines */
+extern HeapTuple SearchSysCacheCopy(int cacheId,
Datum key1, Datum key2, Datum key3, Datum key4);
-extern HeapTuple SearchSysCacheTupleCopy(int cacheId,
- Datum key1, Datum key2, Datum key3, Datum key4);
+extern Oid GetSysCacheOid(int cacheId,
+ Datum key1, Datum key2, Datum key3, Datum key4);
+
+/* macro for just probing for existence of a tuple via the syscache */
+#define SearchSysCacheExists(c,k1,k2,k3,k4) \
+ OidIsValid(GetSysCacheOid(c,k1,k2,k3,k4))
+
extern Datum SysCacheGetAttr(int cacheId, HeapTuple tup,
AttrNumber attributeNumber, bool *isNull);