1.Dd January 24, 2024 2.Dt SQLITE3_ENABLE_SHARED_CACHE 3 3.Os 4.Sh NAME 5.Nm sqlite3_enable_shared_cache 6.Nd enable or disable shared pager cache 7.Sh SYNOPSIS 8.In sqlite3.h 9.Ft int 10.Fo sqlite3_enable_shared_cache 11.Fa "int" 12.Fc 13.Sh DESCRIPTION 14This routine enables or disables the sharing of the database cache 15and schema data structures between connections to the same 16database. 17Sharing is enabled if the argument is true and disabled if the argument 18is false. 19.Pp 20This interface is omitted if SQLite is compiled with -DSQLITE_OMIT_SHARED_CACHE. 21The -DSQLITE_OMIT_SHARED_CACHE compile-time 22option is recommended because the use of shared cache mode is discouraged. 23.Pp 24Cache sharing is enabled and disabled for an entire process. 25This is a change as of SQLite version 3.5.0 (dateof:3.5.0). 26In prior versions of SQLite, sharing was enabled or disabled for each 27thread separately. 28.Pp 29The cache sharing mode set by this interface effects all subsequent 30calls to 31.Fn sqlite3_open , 32.Fn sqlite3_open_v2 , 33and 34.Fn sqlite3_open16 . 35Existing database connections continue to use the sharing mode that 36was in effect at the time they were opened. 37.Pp 38This routine returns SQLITE_OK if shared cache was enabled 39or disabled successfully. 40An error code is returned otherwise. 41.Pp 42Shared cache is disabled by default. 43It is recommended that it stay that way. 44In other words, do not use this routine. 45This interface continues to be provided for historical compatibility, 46but its use is discouraged. 47Any use of shared cache is discouraged. 48If shared cache must be used, it is recommended that shared cache only 49be enabled for individual database connections using the 50.Fn sqlite3_open_v2 51interface with the SQLITE_OPEN_SHAREDCACHE flag. 52.Pp 53Note: This method is disabled on MacOS X 10.7 and iOS version 5.0 and 54will always return SQLITE_MISUSE. 55On those systems, shared cache mode should be enabled per-database 56connection via 57.Fn sqlite3_open_v2 58with SQLITE_OPEN_SHAREDCACHE. 59.Pp 60This interface is threadsafe on processors where writing a 32-bit integer 61is atomic. 62.Pp 63.Sh IMPLEMENTATION NOTES 64These declarations were extracted from the 65interface documentation at line 6893. 66.Bd -literal 67SQLITE_API int sqlite3_enable_shared_cache(int); 68.Ed 69.Sh SEE ALSO 70.Xr sqlite3 3 , 71.Xr sqlite3_open 3 , 72.Xr SQLITE_OK 3 , 73.Xr SQLITE_OPEN_READONLY 3 74