Total Complexity | 6 |
Total Lines | 40 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class Cacher |
||
9 | { |
||
10 | 7 | public static function getCacheKey($loggable) |
|
11 | { |
||
12 | 7 | return $loggable->getMorphClass() . '-' . $loggable->getKey() . '-login-log'; |
|
13 | } |
||
14 | |||
15 | 7 | public static function getCacheContent($loggable) |
|
26 | ]; |
||
27 | } |
||
28 | |||
29 | 7 | public static function hasCache($loggable) |
|
32 | } |
||
33 | |||
34 | 7 | public static function setCache($loggable, $seconds = null) |
|
35 | { |
||
36 | 7 | $seconds = $seconds ?? config('loginlog.expire', 60); |
|
37 | |||
38 | 7 | return Cache::put( |
|
39 | 7 | static::getCacheKey($loggable), |
|
40 | 7 | static::getCacheContent($loggable), |
|
41 | 7 | now()->addSeconds($seconds) |
|
42 | ); |
||
43 | } |
||
44 | |||
45 | 1 | public static function pullCache($loggable) |
|
48 | } |
||
49 | } |
||
50 |