Skip to content

Commit

Permalink
use CACHE_ALL_POLICIES in .env (#4)
Browse files Browse the repository at this point in the history
use CACHE_ALL_POLICIES in .env file to enable / disable global policy caching
  • Loading branch information
ruaq authored Feb 1, 2023
1 parent d5250c9 commit 9584723
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,15 @@ return [
/*
* When enabled, the package will cache the results of all Policies in your Laravel application
*/
'cache_all_policies' => true,
'cache_all_policies' => env('CACHE_ALL_POLICIES', true),
];
```
You can also use `CACHE_ALL_POLICIES` in your `.env` file to change it.
```.dotenv
CACHE_ALL_POLICIES=false
```
## Usage
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.
Expand Down
2 changes: 1 addition & 1 deletion config/policy-soft-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
/*
* When enabled, the package will cache the results of all Policies in your Laravel application
*/
'cache_all_policies' => true,
'cache_all_policies' => env('CACHE_ALL_POLICIES', true),
];

0 comments on commit 9584723

Please sign in to comment.