mirror of
https://github.com/stancl/tenancy-docs.git
synced 2025-12-13 02:34:03 +00:00
Document cached tenant lookup fix #46
This commit is contained in:
parent
af8e403504
commit
0e8a9a7ac9
2 changed files with 17 additions and 0 deletions
|
|
@ -79,6 +79,7 @@ return [
|
||||||
'Tenants' => 'tenants',
|
'Tenants' => 'tenants',
|
||||||
'Central App' => 'central-app',
|
'Central App' => 'central-app',
|
||||||
'Universal Routes' => 'universal-routes',
|
'Universal Routes' => 'universal-routes',
|
||||||
|
'Cacheed Tenant Lookup' => 'cached-tenant-lookup',
|
||||||
'Custom Database Names' => 'custom-database-names',
|
'Custom Database Names' => 'custom-database-names',
|
||||||
'Custom DB Connections' => 'custom-db-connections',
|
'Custom DB Connections' => 'custom-db-connections',
|
||||||
'Disabling DB Creation' => 'disabling-db-creation',
|
'Disabling DB Creation' => 'disabling-db-creation',
|
||||||
|
|
|
||||||
16
docs/source/v2/cached-tenant-lookup.blade.md
Normal file
16
docs/source/v2/cached-tenant-lookup.blade.md
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
---
|
||||||
|
title: Cached Tenant Lookup
|
||||||
|
description: Cached Tenant Lookup
|
||||||
|
extends: _layouts.documentation
|
||||||
|
section: content
|
||||||
|
---
|
||||||
|
|
||||||
|
# Cached Tenant Lookup {#cached-tenant-lookup}
|
||||||
|
|
||||||
|
If you're using the database storage driver, you may want to cache tenant lookup (domain -> tenant id -> `Tenant` object mapping). Running DB queries on each request to identify the tenant is somewhat expensive, as a separate database connection has to be established.
|
||||||
|
|
||||||
|
To avoid this, you may want to enable caching.
|
||||||
|
|
||||||
|
You may enable this feature by setting the `tenancy.storage_drivers.db.cache_store` config key to the name of your cache store (e.g. `redis`), and optionally setting `cache_ttl` (default is 3600 seconds).
|
||||||
|
|
||||||
|
The cache invalidation of course happens automatically, as long as you modify your tenants using `Tenant` objects and not direct DB calls.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue