diff options
author | Jesse Rittner <rittneje@gmail.com> | 2019-01-04 18:54:34 -0500 |
---|---|---|
committer | Jesse Rittner <rittneje@gmail.com> | 2019-01-04 18:54:34 -0500 |
commit | 2ee07a473ff94a41b0e3163ab543d0897e30f67d (patch) | |
tree | 0c185f0e74639d0a11f5c9036a31ac764e0c17b3 | |
parent | Merge pull request #679 from pocke/an-a (diff) | |
download | golite-2ee07a473ff94a41b0e3163ab543d0897e30f67d.tar.gz golite-2ee07a473ff94a41b0e3163ab543d0897e30f67d.tar.xz |
adding additional info to FAQ about in-memory databases
-rw-r--r-- | README.md | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -459,12 +459,16 @@ For an example see [shaxbee/go-spatialite](https://github.com/shaxbee/go-spatial Each connection to :memory: opens a brand new in-memory sql database, so if the stdlib's sql engine happens to open another connection and you've only specified ":memory:", that connection will see a brand new database. A - workaround is to use "file::memory:?mode=memory&cache=shared". Every - connection to this string will point to the same in-memory database. + workaround is to use `"file::memory:?cache=shared"` (or `"file:foobar?mode=memory&cache=shared"`). Every + connection to this string will point to the same in-memory database. + + Note that if the last database connection in the pool closes, the in-memory database is deleted. Make sure the [max idle connection limit](https://golang.org/pkg/database/sql/#DB.SetMaxIdleConns) is > 0, and the [connection lifetime](https://golang.org/pkg/database/sql/#DB.SetConnMaxLifetime) is infinite. For more information see * [#204](https://github.com/mattn/go-sqlite3/issues/204) * [#511](https://github.com/mattn/go-sqlite3/issues/511) + * https://www.sqlite.org/sharedcache.html#shared_cache_and_in_memory_databases + * https://www.sqlite.org/inmemorydb.html#sharedmemdb - Reading from database with large amount of goroutines fails on OSX. |