Skip to content

Commit

Permalink
chore: update docs and suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
taka-oyama committed Mar 6, 2024
1 parent 4d6a97f commit 13a9943
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Laravel database driver for Google Cloud Spanner
- [gRPC extension](https://cloud.google.com/php/grpc)
- [protobuf extension](https://cloud.google.com/php/grpc#install_the_protobuf_runtime_library) (not required, but strongly recommended)
- Currently only supports Spanner running GoogleSQL (PostgreSQL mode not supported)
- `sysvmsg`, `sysvsem`, `sysvshm` extensions (strongly recommended for better performance)

## Installation
Put JSON credential file path to env variable: `GOOGLE_APPLICATION_CREDENTIALS`
Expand Down Expand Up @@ -328,10 +329,19 @@ This means that if you make any modifications through the above functions and th


### SessionPool and AuthCache

In order to improve the performance of the first connection per request, we use [AuthCache](https://github.com/googleapis/google-cloud-php#caching-access-tokens) and [CacheSessionPool](https://googleapis.github.io/google-cloud-php/#/docs/google-cloud/latest/spanner/session/cachesessionpool).

By default, laravel-spanner uses [Filesystem Cache Adapter](https://symfony.com/doc/current/components/cache/adapters/filesystem_adapter.html) as the caching pool. If you want to use your own caching pool, you can extend ServiceProvider and inject it into the constructor of `Colopl\Spanner\Connection`.
By default, this library uses [Filesystem Cache Adapter](https://symfony.com/doc/current/components/cache/adapters/filesystem_adapter.html) as the caching pool. If you want to use your own caching pool, you can extend ServiceProvider and inject it into the constructor of `Colopl\Spanner\Connection`.

The initialization of each session takes about a second, so warming up the sessions during the boot up phase of your
server is recommended. This can be achieved by running the `php artisan spanner:warmup` command. You can set the number
of sessions to warm up by setting the `connections.{name}.session_pool.maxSessions` option in `config/database.php`

Similarly, the sessions remain active for 60 minutes after use so deleting the sessions during the shutdown phase
of your server is recommended. This can be achieved by running the `php artisan spanner:cooldown` command.

```php

### Queue Worker

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"test": "phpunit"
},
"suggest": {
"ext-protobuf": "Native support for protobuf is available. Will use pure PHP implementation if not present.",
"ext-sysvmsg": "Can use SemaphoreLock for session handling. Will use FileLock if not present.",
"ext-sysvsem": "Can use SemaphoreLock for session handling. Will use FileLock if not present.",
"ext-sysvshm": "Can use SemaphoreLock for session handling. Will use FileLock if not present."
Expand Down

0 comments on commit 13a9943

Please sign in to comment.