-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
164 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace Descope\SDK\Cache; | ||
|
||
class APCuCache implements CacheInterface | ||
{ | ||
public function get(string $key) | ||
{ | ||
return apcu_fetch($key); | ||
} | ||
|
||
public function set(string $key, $value, int $ttl = 3600): bool | ||
{ | ||
return apcu_store($key, $value, $ttl); | ||
} | ||
|
||
public function delete(string $key): bool | ||
{ | ||
return apcu_delete($key); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace Descope\SDK\Cache; | ||
|
||
interface CacheInterface | ||
{ | ||
public function get(string $key); | ||
public function set(string $key, $value, int $ttl = 3600): bool; | ||
public function delete(string $key): bool; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace Descope\SDK\Cache; | ||
|
||
use Illuminate\Support\Facades\Cache; | ||
|
||
class LaravelCache implements CacheInterface | ||
{ | ||
public function get(string $key) | ||
{ | ||
return Cache::get($key); | ||
} | ||
|
||
public function set(string $key, $value, int $ttl = 3600): bool | ||
{ | ||
return Cache::put($key, $value, $ttl / 60); | ||
} | ||
|
||
public function delete(string $key): bool | ||
{ | ||
return Cache::forget($key); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace Descope\SDK\Cache; | ||
|
||
class NullCache implements CacheInterface | ||
{ | ||
public function get(string $key) | ||
{ | ||
return null; | ||
} | ||
|
||
public function set(string $key, $value, int $ttl = 3600): bool | ||
{ | ||
return true; | ||
} | ||
|
||
public function delete(string $key): bool | ||
{ | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters