TolRedis package
The TolRedis package provides a TOL interface to Redis. Redis is a very efficient in memory key/value. It supports data persistence, networked client/server operation, structured value types, data expriration, clustering, multicast-like publish/subscribe, all in a very fast implementation.
The following example illustrates a simple use of TolRedis:
#Require TolRedis; TolRedis::@Client r = [[ Text _.host = "host.domain.com" ]]; Real r::Open(?); Text key = "TestWriteRead_key"; Real statusSET = redis::KSet( key, "Hello Redis" ); WriteLn( "statusSET = " << statusSET ); Text value = redis::KGet( key ); WriteLn( "value from GET = " << value ); Real r::Close(?);
The previous example open a connection to the server host.domain.com
, write a string value into the key TestWriteRead_key
and then read it back from the server. The redis server is expected to be running at the specified host. By default de server is listenig at port 6379. If another port is used by the server the client can specify the number as an argument to TolRedis::@Client
construction, ie.:
TolRedis::@Client r = [[ Text _.host = "host.domain.com", _.port = 5555 ]];