Skip to content

Commit c537be9

Browse files
committed
Update components with new cache TTL
1 parent fd6eb89 commit c537be9

File tree

7 files changed

+11
-14
lines changed

7 files changed

+11
-14
lines changed

src/Illuminate/Console/Scheduling/CacheEventMutex.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(Cache $cache)
4040
public function create(Event $event)
4141
{
4242
return $this->cache->store($this->store)->add(
43-
$event->mutexName(), true, $event->expiresAt
43+
$event->mutexName(), true, $event->expiresAt * 60
4444
);
4545
}
4646

src/Illuminate/Console/Scheduling/CacheSchedulingMutex.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(Cache $cache)
4242
public function create(Event $event, DateTimeInterface $time)
4343
{
4444
return $this->cache->store($this->store)->add(
45-
$event->mutexName().$time->format('Hi'), true, 60
45+
$event->mutexName().$time->format('Hi'), true, 3600
4646
);
4747
}
4848

src/Illuminate/Filesystem/Cache.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ class Cache extends AbstractCache
2222
protected $key;
2323

2424
/**
25-
* The cache expiration time in minutes.
25+
* The cache expiration time in seconds.
2626
*
27-
* @var int
27+
* @var int|null
2828
*/
2929
protected $expire;
3030

@@ -39,10 +39,7 @@ public function __construct(Repository $repository, $key = 'flysystem', $expire
3939
{
4040
$this->key = $key;
4141
$this->repository = $repository;
42-
43-
if (! is_null($expire)) {
44-
$this->expire = (int) ceil($expire / 60);
45-
}
42+
$this->expire = $expire;
4643
}
4744

4845
/**

src/Illuminate/Foundation/Auth/ThrottlesLogins.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ protected function hasTooManyLoginAttempts(Request $request)
3333
protected function incrementLoginAttempts(Request $request)
3434
{
3535
$this->limiter()->hit(
36-
$this->throttleKey($request), $this->decayMinutes()
36+
$this->throttleKey($request), $this->decayMinutes() * 60
3737
);
3838
}
3939

src/Illuminate/Routing/Middleware/ThrottleRequests.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function handle($request, Closure $next, $maxAttempts = 60, $decayMinutes
5353
throw $this->buildException($key, $maxAttempts);
5454
}
5555

56-
$this->limiter->hit($key, $decayMinutes);
56+
$this->limiter->hit($key, $decayMinutes * 60);
5757

5858
$response = $next($request);
5959

src/Illuminate/Session/CacheBasedSessionHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function read($sessionId)
6363
*/
6464
public function write($sessionId, $data)
6565
{
66-
return $this->cache->put($sessionId, $data, $this->minutes);
66+
return $this->cache->put($sessionId, $data, $this->minutes * 60);
6767
}
6868

6969
/**

tests/Console/Scheduling/CacheSchedulingMutexTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,23 @@ public function setUp()
5252

5353
public function testMutexReceivesCorrectCreate()
5454
{
55-
$this->cacheRepository->shouldReceive('add')->once()->with($this->event->mutexName().$this->time->format('Hi'), true, 60)->andReturn(true);
55+
$this->cacheRepository->shouldReceive('add')->once()->with($this->event->mutexName().$this->time->format('Hi'), true, 3600)->andReturn(true);
5656

5757
$this->assertTrue($this->cacheMutex->create($this->event, $this->time));
5858
}
5959

6060
public function testCanUseCustomConnection()
6161
{
6262
$this->cacheFactory->shouldReceive('store')->with('test')->andReturn($this->cacheRepository);
63-
$this->cacheRepository->shouldReceive('add')->once()->with($this->event->mutexName().$this->time->format('Hi'), true, 60)->andReturn(true);
63+
$this->cacheRepository->shouldReceive('add')->once()->with($this->event->mutexName().$this->time->format('Hi'), true, 3600)->andReturn(true);
6464
$this->cacheMutex->useStore('test');
6565

6666
$this->assertTrue($this->cacheMutex->create($this->event, $this->time));
6767
}
6868

6969
public function testPreventsMultipleRuns()
7070
{
71-
$this->cacheRepository->shouldReceive('add')->once()->with($this->event->mutexName().$this->time->format('Hi'), true, 60)->andReturn(false);
71+
$this->cacheRepository->shouldReceive('add')->once()->with($this->event->mutexName().$this->time->format('Hi'), true, 3600)->andReturn(false);
7272

7373
$this->assertFalse($this->cacheMutex->create($this->event, $this->time));
7474
}

0 commit comments

Comments
 (0)