You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13Lines changed: 13 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,7 @@ relationships. This package is an attempt to address those requirements.
21
21
- automatic, self-invalidating model query caching.
22
22
- automatic use of cache tags for cache providers that support them (will
23
23
flush entire cache for providers that don't).
24
+
- support for multitenant implementations by implementing getCachePrefix method in the Model class
24
25
25
26
## Requirements
26
27
- PHP >= 7.1.3
@@ -74,6 +75,18 @@ extends `Illuminate\Foundation\Auth\User`. Overriding that would break functiona
74
75
Not only that, but it probably isn't a good idea to cache the user model anyway,
75
76
since you always want to pull the most up-to-date info on it.
76
77
78
+
### Multitenant support for cached models
79
+
If you need multitenancy support the same model context (key and tags) needs to be cached for each denant with it's specific values. This requires a separations of cache that is supported by implementing the getCachePrefix method in the model class.
80
+
81
+
I would recommend to implement in your application a TenantCachable trait containing the getCachePrefix method that for example returns a unique value corresponding to each tenant.
82
+
An example in the context of using the hyn/multi-tenant package can be:
0 commit comments