question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

get existing redis client to access rediscala api

See original GitHub issue

Is there a way to get the underlying rediscala client to be able to use the complete set of its API in addition to the convenient API of the caches?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
KarelCemuscommented, Mar 5, 2019

First of all, if there is anything you miss in the play redis, feel free to propose a new feature.

Second, I don’t see your problem since the client you created in this.client transitively implements redis.commands.Sets. Therefore, just call this.client.scard("my-key") and you are done. Note, that this is asynchronous method returning a scala.concurent.Future, which must be converted into its Java version (CompletionStage)

0reactions
sim-jaccommented, Mar 4, 2019

@KarelCemus : Thanks for the fast and great reply!

I need access to the SortedSet commands in redis to implement a sorted, unique list. And because we are using your plugin for the list and map handling with ease I don’t want to replace it with something like jedis.

Unfortunately it is very hard for me to read scala code and I don’t fully get how to access the RedisClient.

I could create and map the scala-attributes of the client in Java:

String host = config.getString("play.cache.redis.host");
Option<String> pw = Option.apply(config.getString("play.cache.redis.password"));
Option<Object> db = Option.apply(config.getInt("play.cache.redis.database"));
int port = config.getInt("play.cache.redis.port");
        
Option<FiniteDuration> timeout = Option.empty();
var dispatcher = new RedisDispatcher("my.rediscala.rediscala-client-worker-dispatcher");
        
this.client = new RedisClient(host, port, pw, db, "My-Connection", timeout, system, dispatcher);

But I could not achieve how to send the commands (which are defined in redis.commands.Set?) to the connection. Maybe you have another hint for me?

Thanks and best regards Simon

Read more comments on GitHub >

github_iconTop Results From Across the Web

Redis CLI
To launch the program in special modes, you can use several options, including: Simulate a replica and print the replication stream it receives...
Read more >
Use the REST API | Redis Documentation Center
Use the cURL HTTP client. cURL is a popular command line tool used to perform HTTP requests, either as individual commands or within...
Read more >
Step 4: Connect to the cluster's node - Amazon ElastiCache ...
For instructions on how to connect to an Amazon EC2 instance, see the Amazon EC2 Getting Started Guide. Download and install redis-cli utility...
Read more >
Building REST API backed by Redis | by Mohammed Hewedy
Let's use redis-cli to enable the AOF persistence to get up to the last 1 second persistence we talked about in the introduction....
Read more >
etaty/rediscala: Non-blocking, Reactive Redis driver ... - GitHub
The idea behind transactions in Rediscala is to start a transaction outside of a redis connection. We use the TransactionBuilder to store call...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found