jedis icon indicating copy to clipboard operation
jedis copied to clipboard

jedis can support `interceptor`?

Open taotao365s opened this issue 5 years ago • 4 comments

Expected behavior

jedis.get() // send some statistic info to other system. jedis.close // send some statistic info to other system.

Actual behavior

no found any feature

Steps to reproduce:

Redis / Jedis Configuration

Jedis version:

Redis version:

Java version:

taotao365s avatar Jul 15 '19 06:07 taotao365s

Interceptors are just not in scope for Jedis. If you really need this, just subclass Jedis. I.e. something like:

public class MyJedis extends Jedis {
...
  @Override
  public String get(final String key) {
    // send some statistic info to other system.
    return super.get(key);
  }
...
}

maksymkovalenko avatar Oct 15 '19 21:10 maksymkovalenko

Interceptors are just not in scope for Jedis. If you really need this, just subclass Jedis. I.e. something like:

public class MyJedis extends Jedis {
...
  @Override
  public String get(final String key) {
    // send some statistic info to other system.
    return super.get(key);
  }
...
}

@maksymkovalenko I know that this can do it, but this should override many methods of super. It should support this feature in core of Jedis.

taotao365s avatar Oct 24 '19 00:10 taotao365s

alternatively, you could just use aspects example: https://www.baeldung.com/spring-aop you can even make it a "jedis-interceptos" lib that others can use.

Alternatively, jedis could make http client to be passed as one of the constructor params instead of creating it internally, so that people can configure any interceptors with it. Unfortunately (or not) Jedis is not using http client, but just native java sockets.

Max

On Wed, Oct 23, 2019 at 5:28 PM william [email protected] wrote:

Interceptors are just not in scope for Jedis. If you really need this, just subclass Jedis. I.e. something like:

public class MyJedis extends Jedis { ... @Override public String get(final String key) { // send some statistic info to other system. return super.get(key); } ... }

I know that this can do it, but this should override many methods of super. It should support this feature in core of Jedis.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/xetorthio/jedis/issues/2022?email_source=notifications&email_token=ACXCXWMVHD5FYN3CWMCT77LQQDT4LA5CNFSM4IDTN5EKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECDJGVY#issuecomment-545690455, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACXCXWNSEDPZLCLWO7MZYXLQQDT4LANCNFSM4IDTN5EA .

-- Max Kovalenko MileZero http://www.milezero.com/ | 206.349.0871 <//206.349.0871> 615 2nd Ave, Ste 150, Seattle, WA 98104

maksymkovalenko avatar Oct 24 '19 17:10 maksymkovalenko

This issue is marked stale. It will be closed in 30 days if it is not updated.

github-actions[bot] avatar Feb 15 '24 00:02 github-actions[bot]