#ifndef _PCACHE_H_
typedef struct PgHdr PgHdr;
typedef struct PCache PCache;
struct PgHdr {
sqlite3_pcache_page *pPage;
void *pData;
void *pExtra;
PCache *pCache;
PgHdr *pDirty;
Pager *pPager;
Pgno pgno;
#ifdef SQLITE_CHECK_PAGES
u32 pageHash;
#endif
u16 flags;
i64 nRef;
PgHdr *pDirtyNext;
PgHdr *pDirtyPrev;
};
#define PGHDR_CLEAN 0x001
#define PGHDR_DIRTY 0x002
#define PGHDR_WRITEABLE 0x004
#define PGHDR_NEED_SYNC 0x008
#define PGHDR_DONT_WRITE 0x010
#define PGHDR_MMAP 0x020
#define PGHDR_WAL_APPEND 0x040
int sqlite3PcacheInitialize(void);
void sqlite3PcacheShutdown(void);
void sqlite3PCacheBufferSetup(void *, int sz, int n);
int sqlite3PcacheOpen(
int szPage,
int szExtra,
int bPurgeable,
int (*xStress)(void*, PgHdr*),
void *pStress,
PCache *pToInit
);
int sqlite3PcacheSetPageSize(PCache *, int);
int sqlite3PcacheSize(void);
sqlite3_pcache_page *sqlite3PcacheFetch(PCache*, Pgno, int createFlag);
int sqlite3PcacheFetchStress(PCache*, Pgno, sqlite3_pcache_page**);
PgHdr *sqlite3PcacheFetchFinish(PCache*, Pgno, sqlite3_pcache_page *pPage);
void sqlite3PcacheRelease(PgHdr*);
void sqlite3PcacheDrop(PgHdr*);
void sqlite3PcacheMakeDirty(PgHdr*);
void sqlite3PcacheMakeClean(PgHdr*);
void sqlite3PcacheCleanAll(PCache*);
void sqlite3PcacheClearWritable(PCache*);
void sqlite3PcacheMove(PgHdr*, Pgno);
void sqlite3PcacheTruncate(PCache*, Pgno x);
PgHdr *sqlite3PcacheDirtyList(PCache*);
void sqlite3PcacheClose(PCache*);
void sqlite3PcacheClearSyncFlags(PCache *);
void sqlite3PcacheClear(PCache*);
i64 sqlite3PcacheRefCount(PCache*);
void sqlite3PcacheRef(PgHdr*);
i64 sqlite3PcachePageRefcount(PgHdr*);
int sqlite3PcachePagecount(PCache*);
#if defined(SQLITE_CHECK_PAGES) || defined(SQLITE_DEBUG)
void sqlite3PcacheIterateDirty(PCache *pCache, void (*xIter)(PgHdr *));
#endif
#if defined(SQLITE_DEBUG)
int sqlite3PcachePageSanity(PgHdr*);
#endif
void sqlite3PcacheSetCachesize(PCache *, int);
#ifdef SQLITE_TEST
int sqlite3PcacheGetCachesize(PCache *);
#endif
int sqlite3PcacheSetSpillsize(PCache *, int);
void sqlite3PcacheShrink(PCache*);
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
int sqlite3PcacheReleaseMemory(int);
#endif
#ifdef SQLITE_TEST
void sqlite3PcacheStats(int*,int*,int*,int*);
#endif
void sqlite3PCacheSetDefault(void);
int sqlite3HeaderSizePcache(void);
int sqlite3HeaderSizePcache1(void);
int sqlite3PCachePercentDirty(PCache*);
#ifdef SQLITE_DIRECT_OVERFLOW_READ
int sqlite3PCacheIsDirty(PCache *pCache);
#endif
#endif