Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add sentinel support #399

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

beaumind
Copy link

No description provided.

@codecov
Copy link

codecov bot commented Jul 31, 2022

Codecov Report

❗ No coverage uploaded for pull request base (main@ddb8bab). Click here to learn what that means.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #399   +/-   ##
=======================================
  Coverage        ?   96.24%           
  Complexity      ?      382           
=======================================
  Files           ?       21           
  Lines           ?     1012           
  Branches        ?        0           
=======================================
  Hits            ?      974           
  Misses          ?       38           
  Partials        ?        0           

Help us with your feedback. Take ten seconds to tell us how you rate us.

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.

Copy link
Owner

@ankitpokhrel ankitpokhrel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @beaumind, sorry for reviewing this late and thank you for the PR. I added some comments.

public function __construct(array $params = [], array $options = [])
{
$options = empty($options) ? Config::get('sentinel.options') : $options;
$params = empty($params) ? Config::get('sentinel.params') : $params;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add an example of how sentinel options/params looks like, probably in the README?

use TusPhp\Config;
use Predis\Client as RedisClient;

class RedisSentinelStore extends AbstractCache
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this could directly extend RedisStore

$options = empty($options) ? Config::get('sentinel.options') : $options;
$params = empty($params) ? Config::get('sentinel.params') : $params;

$this->redis = new RedisClient($params, $options);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we only need to pass missing option in RedisClient, then we can just update RedisStore to accept second parameter instead of writing a new implementation. This should not break backwards compatibility.

public function __construct(array $options = [], array $params = [])

instead of

public function __construct(array $options = [])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants