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

Support for a custom command to flush Redis database. #337

Open
eltherion opened this issue Jan 31, 2020 · 0 comments
Open

Support for a custom command to flush Redis database. #337

eltherion opened this issue Jan 31, 2020 · 0 comments

Comments

@eltherion
Copy link

Hi, I'm evaluating ScalaCache usage, but I've got one problem. In order to avoid accidental flushing of a Redis prod database we have this configuration enabled (example aliases, ofc):

rename-command FLUSHALL FLUSHALLNEW
rename-command FLUSHDB FLUSHDBNEW

That means standard:

removeAll[T]()

will not work, bc it uses hardcoded FLUSHDB command resulting in that exception:

  redis.clients.jedis.exceptions.JedisDataException: ERR unknown command `FLUSHDB`,
  with args beginning with: 
  redis.clients.jedis.Protocol.processError(Protocol.java:130)
  redis.clients.jedis.Protocol.process(Protocol.java:164)
  redis.clients.jedis.Protocol.read(Protocol.java:218)
  redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:341)
  redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:240)
  redis.clients.jedis.BinaryJedis.flushDB(BinaryJedis.java:361)
  scalacache.redis.RedisCache.$anonfun$doRemoveAll$1(RedisCache.scala:20)
  scalacache.AsyncForId$.delay(Async.scala:48)
  scalacache.redis.RedisCache.doRemoveAll(RedisCache.scala:17)
  scalacache.AbstractCache.removeAll(AbstractCache.scala:76)
  scalacache.AbstractCache.removeAll$(AbstractCache.scala:75)
  scalacache.redis.RedisCache.removeAll(RedisCache.scala:12)
  scalacache.package$RemoveAll.apply(package.scala:63)

Is there any workaround for that? I don't want to mix libraries and I would like to avoid low level calls, but I might accept it if inevitable.

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

No branches or pull requests

1 participant