]> git.saurik.com Git - redis.git/blob - client-libraries/scala/src/main/scala/com/redis/RedisClient.scala
ac051cc5837a47055b2fe1222b595def2e64d28c
[redis.git] / client-libraries / scala / src / main / scala / com / redis / RedisClient.scala
1 package com.redis
2
3 import com.redis.operations._
4
5 /**
6 * Redis client
7 *
8 */
9
10 class Redis(val host: String, val port: Int) extends Operations with ListOperations with SetOperations with NodeOperations with KeySpaceOperations with SortOperations {
11
12 // auxiliary constructor
13 def this() = this("localhost", 6379)
14
15 // Points to the connection to a server instance
16 val connection = Connection(host, port)
17 var db: Int = 0
18
19 // Connect and Disconnect to the Redis server
20 def connect = connection.connect
21 def disconnect = connection.disconnect
22 def connected: Boolean = connection.connected
23
24 // Establish the connection to the server instance on initialize
25 connect
26
27 // Get Redis Client connection.
28 def getConnection(key: String) = getConnection
29 def getConnection = connection
30
31 // Outputs a formatted representation of the Redis server.
32 override def toString = connection.host+":"+connection.port+" <connected:"+connection.connected+">"
33 }