Cache miss resolves with null value by WyriHaximus · Pull Request #22 · reactphp/cache · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions README.md
2 changes: 1 addition & 1 deletion src/ArrayCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ArrayCache implements CacheInterface
public function get($key)
{
if (!isset($this->data[$key])) {
return Promise\reject();
return Promise\resolve(null);
}

return Promise\resolve($this->data[$key]);
Expand Down
2 changes: 1 addition & 1 deletion src/CacheInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface CacheInterface
{
/**
* Retrieve an item from the cache, resolves with its value on
* success or rejects when no item can be found.
* success or null when no item can be found.
*
* @param string $key
* @return PromiseInterface
Expand Down
16 changes: 11 additions & 5 deletions tests/ArrayCacheTest.php