You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Simple set operations, where I want to set key and value as a text file. For example my key:A100 and its value:A100.obj or A100.txt.
Get that value from redis server and check size of the value.
Below is my code (basically I am trying to use redis as a simple database where my files are associated with unique keys and I could access them using the get method).
CODE:
val host = "localhost"
val port = 6379
val file = "A100.obj"
var key1 = "A100"
val value1 = file //seems this is taking the filename as string (not the file itself)
try {
var r = new RedisClient(host, port)
r.set(key1, value1)
println(r.get(key1))
println(r.strlen(key1))
}catch{
case err: Exception => println("Exception: ", err)
}
OUTPUT:
Some(A100.obj)
Some(8)
Any help on this is appreciated and let me know if I could provide any additional information for this. Thank you.
The text was updated successfully, but these errors were encountered:
I am not sure I understand what you are trying to do here. When u do val value1 = file do you expect to assign the contents of the file to value1. This is not going to happen.
I am trying to do two things:
A100
and its value:A100.obj
orA100.txt
.Below is my code (basically I am trying to use redis as a simple database where my files are associated with unique keys and I could access them using the get method).
Any help on this is appreciated and let me know if I could provide any additional information for this. Thank you.
The text was updated successfully, but these errors were encountered: