Skip to content

A Redis client for Pharo using Stick auto-reconnection layer

License

Notifications You must be signed in to change notification settings

mumez/RediStick

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RediStick

CI

A Redis client for Pharo (and GemStone/S) using Stick auto-reconnection layer

Many parts are borrowed from RedisClient.

However RediStick use Stick for supporting auto reconnection.

Installation

Default (Core only)

Metacello new
  baseline: 'RediStick';
  repository: 'github://mumez/RediStick/repository';
  load.

With Connection-Pool package

Metacello new
  baseline: 'RediStick';
  repository: 'github://mumez/RediStick/repository';
  load: #('Core' 'ConnectionPool').

With Pubsub package

Metacello new
  baseline: 'RediStick';
  repository: 'github://mumez/RediStick/repository';
  load: #('Core' 'Pubsub').

With Stream package

Metacello new
  baseline: 'RediStick';
  repository: 'github://mumez/RediStick/repository';
  load: #('StreamObjects').
stream low-level API only
Metacello new
  baseline: 'RediStick';
  repository: 'github://mumez/RediStick/repository';
  load: #('Core' 'Stream').

With Search package

Metacello new
  baseline: 'RediStick';
  repository: 'github://mumez/RediStick/repository';
  load: #('Core' 'Search').

Sample Code

Basic usage

stick := RsRediStick targetUrl: 'sync://localhost'.
stick connect.

stick beSticky. "Auto reconnect when server is not accessible"
stick beSwitchy: 'sync://otherhost'. "Or connect to the secondary server"
stick onError: [ :e | e pass ]. "Or just pass an error (not reconnect) - mainly for debug"

stick endpoint info.
stick endpoint get: 'a'.
stick endpoint set: 'a' value: 999.

Using a connection pool with a wrapper class

RsRedisConnectionPool primaryUrl: 'sync://localhost:6379'.
redis := RsRedisProxy of: #client1.
redis at: 'a'.
redis at: 'a' put: 999.

In this example, the default connection pool is implicitly used through RedisProxy.

Using Pubsub channel

RediStick provides a channel class for using redis pubsub API very easily.

Please read Pubsub.md.

Using Stream

RediStick supports Redis Streams - distributed event streaming API.

Please read Stream.md.

Using Search

RediStick supports RediSearch - a full-text search extension for Redis.

Please read Search.md.

About

A Redis client for Pharo using Stick auto-reconnection layer

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published