Skip to content

Commit 9584723

Browse files
authored
use CACHE_ALL_POLICIES in .env (#4)
use CACHE_ALL_POLICIES in .env file to enable / disable global policy caching
1 parent d5250c9 commit 9584723

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,15 @@ return [
3131
/*
3232
* When enabled, the package will cache the results of all Policies in your Laravel application
3333
*/
34-
'cache_all_policies' => true,
34+
'cache_all_policies' => env('CACHE_ALL_POLICIES', true),
3535
];
3636
```
3737
38+
You can also use `CACHE_ALL_POLICIES` in your `.env` file to change it.
39+
```.dotenv
40+
CACHE_ALL_POLICIES=false
41+
```
42+
3843
## Usage
3944
4045
By default, this package caches all policy calls of your entire application. You can disable this behavior by setting the ```cache_all_policies```configuration to false. Now you can specify which Policy classes should be soft cached and which not. If you want your policy to be cached, add the ```Innoge\LaravelPolicySoftCache\Contracts\SoftCacheable``` interface.

config/policy-soft-cache.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
/*
55
* When enabled, the package will cache the results of all Policies in your Laravel application
66
*/
7-
'cache_all_policies' => true,
7+
'cache_all_policies' => env('CACHE_ALL_POLICIES', true),
88
];

0 commit comments

Comments
 (0)