Giter Site home page Giter Site logo

scala-redis's People

Contributors

acrosa avatar fcarriedo avatar kevinpet avatar twilliam avatar zvozin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scala-redis's Issues

PubSub support

Thanks for the library. Do you have plans to implement pubsub support in scala-redis? Akka seems to have a nice implementation, but having it in a small and simple lib like this would be great.

Scala redis - Unicode strings insertion problem

Hi,

I was trying out your scala-redis library for my project. I encountered problems when inserting unicode strings into redis database.
Some of the unicode strings are not inserted at all, some of them are getting inserted but only a part of it. I tried with my scala interpreter too. At one point it just give array index out of bounds exception or it hangs (infinite loop or something). I have dumped the errors below.

Please let me know, if you have any suggestions or fixes for this.
I appreciate any kind of input.

Thank you.

Sincerely,
Anandan Rangasamy.

Here's the dump:
//one part of it
scala> val r = new Redis()
r: com.redis.Redis = localhost:6379 connected:true

scala> r.pushHead("Aäko","Aäkon Këëtrëh")
res7: Boolean = true

scala> r.listLength("Aäko")
res8: Option[Int] = None

//another one

scala> val r = new Redis()
r: com.redis.Redis = localhost:6379 connected:true

scala> r.listLength("Aäko")
res6: Option[Int] = Some(2)

scala> r.listRange("Aäko",0,1)
java.lang.ArrayIndexOutOfBoundsException: 1
at com.redis.SocketOperations$class.bulkReply(SocketOperations.scala:152)
at com.redis.Connection.bulkReply(Connection.scala:8)
at com.redis.SocketOperations$$anonfun$listReply$1.apply(SocketOperations.scala:171)
at com.redis.SocketOperations$$anonfun$listReply$1.apply(SocketOperations.scala:170)
at scala.Range.foreach(Range.scala:44)
...
scala> r.listRange("Aal",0,1)
res1: Option[List[String]] = Some(List(Aal, Aalacho))

scala> r.listRange("Aän",0,1)
res2: Option[List[String]] = None

scala> r.listRange("Aan",0,-1)
res3: Option[List[String]] = Some(List(Aan, Aantar Lee Coates, Aantonio ZZ))

scala> r.listRange("Aäkon",0,-1)
java.lang.ArrayIndexOutOfBoundsException: 1
at com.redis.SocketOperations$class.bulkReply(SocketOperations.scala:152)
at com.redis.Connection.bulkReply(Connection.scala:8)
at com.redis.SocketOperations$$anonfun$listReply$1.apply(SocketOperations.scala:171)
at com.redis.SocketOperations$$anonfun$listReply$1.apply(SocketOperations.scala:170)
at scala.Range.foreach(Range.scala:44)

// anothe one, where it hangs (probably an infinite loop or something)
scala> import com.redis._
import com.redis._

scala> val r = new Redis()
r: com.redis.Redis = localhost:6379 connected:true

scala> r.listLength("Aäkon1")
res0: Option[Int] = Some(1)

scala> r.listRange("Aäkon1",0,-1)

Binary Data Support?

  1. Binary data is not supported in pub/sub mode.

  2. test code:
    #2.1 Subscriber (scala)

    val client = new RedisClient("localhost", 6379)
    client.subscribe("hello")((msg: PubSubMessage) => {
    println("rcv from channel:", msg)

    msg match{
    case m:M => {
    println("rcv", m.message)
    dumpBytes(m.message.getBytes("iso-8859-1"))
    }
    case _ => {println("Unknown...")}
    }
    })

2.2 Publisher (by jedis)
byte[] data = {0x01,0x02,(byte) 0xff};
Jedis jedis = new Jedis("localhost");

jedis.publish("hello".getBytes(), data);

  1. test result:
    (rcv from channel:,S(hello,1))
    Unknown...
    (rcv from channel:,M(hello,���))
    (rcv,���)
    0000 01 02 3f ..?
    ^^^^----> 0xff has been cast to 0x3f

Is there anyone who can give me a suggestion?
Thanks!

get fails to return the expected value

import com.redis._;

object GetFailsTest extends Application {

  val r = new Redis("localhost", 6379)
  r.set("key", "some value")
  println(r.get("key"))
  println(r.get("key").get)
}

I believe that this code should print:
Some("some value")
"some value"
Instead it prints:
None
10

I've compiled with scala-2.7.7 and am running against Redis 2.2.0.

AUTH support?

If I try
val redisClient = RedisClient(endpoint)
redisClient.auth("pwd")

I get an exception

at akka.pattern.AskableActorRef$.ask$extension(AskSupport.scala:136)
at com.redis.api.KeyOperations$class.auth(KeyOperations.scala:112)
at com.redis.api.RedisOps.auth(RedisOps.scala:7)

keys command seems broken

I get invalid results using the keys command. Looks like the results do not get parsed correctly. I'm using redis 2.0.0. Is that supported? Here is a test

@test
def keysIsBroke {
Conn.redis.setAdd("fo1", "1")
Conn.redis.setAdd("fo2", "2")
val result = Conn.redis.keys("fo*")
assertEquals(2, result.get.size)
}

Thread Safety

Is this driver threadsafe? Can I safely access an instance of RedisClient from multiple Actors? I seem to be getting deadlocks immediately after executing a method on RedisClient. I'm a bit new to Scala so forgive me if this is a bad question.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.