Skip to content

Commit

Permalink
change the cache key name of access token
Browse files Browse the repository at this point in the history
  • Loading branch information
jinseokoh committed Apr 2, 2020
1 parent 5979e5f commit 408a63c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "jinseokoh/bootpay",
"description": "Unofficial BootPay package for Laravel",
"type": "library",
"version": "1.0.1",
"version": "1.0.2",
"keywords": ["Laravel", "BootPay"],
"license": "MIT",
"authors": [
Expand Down
18 changes: 9 additions & 9 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions src/BootPayClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

class BootPayClient
{
const ACCESS_TOKEN_KEY = 'bootpay-access-token';

private $client;
private $applicationId;
private $privateKey;
Expand Down Expand Up @@ -44,19 +46,15 @@ public function getPrivateKey(): string
*/
public function getAccessToken(): ?string
{
if ($accessToken = Cache::get('accessToken')) {
return $accessToken;
}

return null;
return Cache::get(self::ACCESS_TOKEN_KEY);
}

/**
* @param string $token
*/
public function setAccessToken(string $token): void
{
Cache::put('accessToken', $token, 60 * 25); // valid for 25 mins
Cache::put(self::ACCESS_TOKEN_KEY, $token, 60 * 25); // valid for 25 mins
}

/**
Expand Down

0 comments on commit 408a63c

Please sign in to comment.