Library Version 18.1.25

Configuring the In-Memory Cache
Prev | Chapter 4. Using DB_CONFIG to configure the Berkeley DB SQL interface | Next

## Configuring the In-Memory Cache

SQLite provides an in-memory cache which you size according to the maximum number of database pages that you want to hold in memory at any given time.

Berkeley DB also provides an in-memory cache that performs the same function as SQLite. You can configure this cache using the exact same PRAGMAs as you are used to using with SQLite. See PRAGMA cache_size and PRAGMA default_cache_size for details. As is the case with SQLite, you use these PRAGMAs to describe the total number of pages that you want in the cache.

However, you can also configure Berkeley DB's in-memory cache size using the `DB_CONFIG` file. When you do this, you do not specify the cache size in terms of the number of pages to be contained there. Instead, you configure it in terms of the total number of bytes that you want it to be able to hold.

Like the in-memory cache for SQLite, you can change Berkeley DB's cache size at any time. However, if you want to manage it using the `DB_CONFIG` file, then you must restart your application. In addition, you must re-create your environment in order for the new value to take effect. See The DB_CONFIG File for details.

To configure your cache size using the `DB_CONFIG` file, use the set_cachesize parameter.

Prev | Up | Next
The DB_CONFIG File | Home | Chapter 5. Using Replication with the SQL API