implementation of a redis driver for voyage framework (no-sql framework).
the CI is running on Pharo 7 & 8. for Pharo 9 there is a baseline error
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.
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/
in order to try you can use class from test class and look at test for more information it can help you.
RsRedisConnectionPool initialize.
repository := VORedisRepository
host: VORedisRepository redisHost
port: VORedisRepository defaultPort
database: 'Voyage-Tests'
username: nil
password: 'goodPassword'.
VORepository setRepository: repository
the API of VORedisRepository is the same as the mongo one but there is some difference.
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']
voRedisRepositoryInstance executeRedisCommand: [:aRsRedis | aRsRedis endpoint seeMethodInRsRedisEndpoint. aRsRedis endpoint unifiedCommand: {#GET . 'aKey'}]
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
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
1- 'MyObjectStoreInRedis:'
2- 'MyObjectStoreInRedis:setIDs'