Skip to content
This repository has been archived by the owner on Feb 16, 2022. It is now read-only.

call closure when redis crashed #139

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](CONTRIBUTING.md).


## [v5.0.1] - 2019-09-24
- Add missing laravel/helpers composer package

## [v5.0.0] - 2019-09-23
- Upgrade to Laravel v6 and update dependencies

Expand Down Expand Up @@ -94,6 +97,7 @@ This project adheres to [Semantic Versioning](CONTRIBUTING.md).
## v1.0.0 - 2016-06-18
- Tag first release

[v5.0.1]: https://github.com/rinvex/laravel-repositories/compare/v5.0.0...v5.0.1
[v5.0.0]: https://github.com/rinvex/laravel-repositories/compare/v4.1.0...v5.0.0
[v4.1.0]: https://github.com/rinvex/laravel-repositories/compare/v4.0.0...v4.1.0
[v4.0.0]: https://github.com/rinvex/laravel-repositories/compare/v3.0.1...v4.0.0
Expand Down
8 changes: 7 additions & 1 deletion src/Repositories/BaseRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,13 @@ protected function executeCallback($class, $method, $args, Closure $closure)

// Check if cache is enabled
if ($this->getCacheLifetime() && ! $this->getContainer('request')->has($skipUri)) {
return $this->cacheCallback($class, $method, $args, $closure);
//call closure when redis throw a throwable
try {
$result = $this->cacheCallback($class, $method, $args, $closure);
} catch (\Throwable $throwable){
$result = call_user_func($closure);
}
return $result;
}

// Cache disabled, just execute query & return result
Expand Down