-
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.
Merge pull request #4 from SoapBox/feature/support-other-responses
[Feature] Support additional response types
- Loading branch information
Showing
3 changed files
with
131 additions
and
15 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,35 @@ | ||
<?php | ||
|
||
namespace SoapBox\Idempotency\Tests\Doubles; | ||
|
||
use Illuminate\Cache\ArrayStore; | ||
|
||
class TestSerializedCacheStore extends ArrayStore | ||
{ | ||
/** | ||
* Retrieve an item from the cache by key. | ||
* | ||
* @param string|array $key | ||
* @return mixed | ||
*/ | ||
public function get($key) | ||
{ | ||
$value = $this->storage[$key] ?? null; | ||
|
||
return $value ? unserialize($value) : null; | ||
} | ||
|
||
/** | ||
* Store an item in the cache for a given number of minutes. | ||
* | ||
* @param string $key | ||
* @param mixed $value | ||
* @param float|int $minutes | ||
* | ||
* @return void | ||
*/ | ||
public function put($key, $value, $minutes) | ||
{ | ||
parent::put($key, serialize($value), $minutes); | ||
} | ||
} |
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