Skip to content

Latest commit

 

History

491 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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/src';
  load.

With Connection-Pool package

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

With Pubsub package

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

With Stream package

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

With Search package

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

With JSON package

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

With TimeSeries package

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

With VectorSet package

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

With Function package

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

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 raw bytes mode

By default, bulk replies are decoded as strings, and outgoing String/ByteArray values are UTF-8 encoded. useRawBytesWhile: switches both directions to raw bytes instead, which is useful for binary-safe values such as serialized blobs.

rawBytes := stick endpoint useRawBytesWhile: [
	stick endpoint set: 'binaryKey' value: someByteArray.
	stick endpoint get: 'binaryKey' ].

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.

Using JSON

RediStick supports RedisJSON - a JSON data type for Redis.

Please read Json.md.

Using TimeSeries

RediStick supports Redis TimeSeries - a time series data type for Redis.

Please read TimeSeries.md.

Using VectorSet

RediStick supports Redis Vector Sets - an approximate nearest-neighbor vector data type built into Redis 8.0+.

Please read VectorSet.md.

Using Function

RediStick supports Redis Functions - server-side Lua functions organized in libraries.

Please read Function.md.

About

A Redis client for Pharo using Stick auto-reconnection layer

Topics

Resources

Stars

10 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages