There was an error while loading. Please reload this page.
2 parents 51ac226 + 03d5ff6 commit 25daba4Copy full SHA for 25daba4
src/Traits/Rememberable.php
@@ -2,6 +2,7 @@
2
3
namespace LaravelEnso\Rememberable\Traits;
4
5
+use Carbon\Carbon;
6
use Illuminate\Support\Facades\Cache;
7
use Illuminate\Support\Facades\Config;
8
@@ -37,7 +38,12 @@ public static function cacheGet($id)
37
38
39
public function cachePut()
40
{
- Cache::put($this->getCacheKey(), $this);
41
+ $limit = $this->getCacheLifetime();
42
+ $key = $this->getCacheKey();
43
+
44
+ return $limit === 'forever'
45
+ ? Cache::forever($key, $this)
46
+ : Cache::put($key, $this, Carbon::now()->addMinutes($limit));
47
}
48
49
public function getCacheKey()
0 commit comments