• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

php-casbin / think-authz / 15025178114

14 May 2025 03:45PM UTC coverage: 92.667%. Remained the same
15025178114

push

github

web-flow
fix: delete without condition if cache disabled (#52)

1 of 1 new or added line in 1 file covered. (100.0%)

139 of 150 relevant lines covered (92.67%)

48.54 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/src/cache/CacheHandler.php
1
<?php
2

3
namespace tauthz\cache;
4

5
use tauthz\model\Rule;
6
use tauthz\traits\Configurable;
7
use think\db\Query;
8

9
class CacheHandler implements CacheHandlerContract
10
{
11
    use Configurable;
12

13
    /**
14
     * Cache policies for the given model.
15
     *
16
     * @param Rule $model The model to cache policies for.
17
     * @return Query|Rule The cached query if caching is disabled, or origin Rule.
18
     */
19
    public function cachePolicies(Rule $model): Query|Rule
20
    {
21
        if ($this->config('cache.enabled', false)) {
108✔
22
            $key = $this->config('cache.key', 'tauthz');
108✔
23
            $expire = $this->config('cache.expire', 0);
108✔
24
            return $model->cache($key, $expire);
108✔
25
        } else {
26
            return $model;
9✔
27
        }
28
    }
29
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc