Skip to content

Latest commit

 

History

History
105 lines (70 loc) · 2.85 KB

README.md

File metadata and controls

105 lines (70 loc) · 2.85 KB

voyage-redis Build Status

implementation of a redis driver for voyage framework (no-sql framework).

CI

the CI is running on Pharo 7 & 8. for Pharo 9 there is a baseline error

author

CafeKrem

I'm work on this project during my internship for my first year of master degree. please if you have advice , better ideas for code quality , or anything that can upgrade code quality , please tell me.

HOW TO

run test

in order to run test you should instantiate a redis database with ReJSON module. This Repository contain a redis configuration file.

you can run this script With Docker.

docker run -p 6379:6379 
-v /your/Absolute/Path/To/redis.conf:/etc/redis/redis.conf 
redislabs/rejson /etc/redis/redis.conf

without docker:

look at https://oss.redislabs.com/redisjson/

run it

in order to try you can use class from test class and look at test for more information it can help you.

initialize a repository

RsRedisConnectionPool initialize.
	repository := VORedisRepository
		host: VORedisRepository redisHost 
		port: VORedisRepository defaultPort
		database: 'Voyage-Tests'
		username: nil
		password: 'goodPassword'.
	VORepository setRepository: repository

API

the API of VORedisRepository is the same as the mongo one but there is some difference.

all message with where , selectOne:where: , selectMany:where: , ...

all those message ONLY take Block

example:

you should not do this

VOTestPilot selectOne: { 'name' -> 'John' }

you SHOULD do this

VOTestPilot selectOne: [:each | each name = 'John']
you want to talk directly to redis
voRedisRepositoryInstance executeRedisCommand: [:aRsRedis | aRsRedis endpoint seeMethodInRsRedisEndpoint. aRsRedis endpoint unifiedCommand: {#GET . 'aKey'}]
adding TTL information

you can add description to your object you just have to define a method like this:

MyObjectStore class >> #myMethod
<redisContainer>
	^ VORedisContainer new
		ttlDuration: 1;
		yourself

implementation

few word about implementation , in order to store object in redis , I decided to use 2 redis data structure :

1- a redis JSON data type who store JSON , when voyage serialize an object it transform it into a pharo collection like a JSON.

2- a set , use to store reference to instance of MyObjectStoreInRedis

typo

1- 'MyObjectStoreInRedis:'

2- 'MyObjectStoreInRedis:setIDs'

dependency