Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 

README.md

redis-tcl

Tcl library for redis access

Build Status

Installation:

'make install' will install the library into what it detects is your library location for tcl. It does this detection through the entirely simple method of using the tclsh in your path to check the output of 'info library' command. The method of detection should be expanded in the future to play more nicely with alternate tcl installations.

Usage:

'package require redis' will get you started.

The 'redis' command creates a redis connection that can then be passed normal redis commands. For example, the following creates a redis connection, and runs the redis time command (it ignores the output however, that part is up to you!):

package require redis
set r [redis $host $port]
$r time

It is possible to use this client for basic pub/sub operations with redis. To subscribe to a channel you must first set a callback through the following:

$r setcallback procname

After the callback is set channels can be subscribed to as:

$r subscribe x y taters

Once a specific connection is set for a subscription it CANNOT be used for other redis communications. At this time it is only possible to bulk unsubscribe from all channels through:

$r unsubscribe

This will also reset callback to empty. To get the callback before unsubscribe:

set callback [$r getcallback]

An example of callback may looks like:

proc onPublish {channels redis type reply} {
  if {[llength $reply]==1 && $reply>0} {
    # OK subscribe $reply
    return
  }

  lassign $reply kind channel data
  # kind = enum { subscribe unsubscribe message }
}

About

Tcl library for redis access

Resources

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.