ff4j
ff4j copied to clipboard
Feature/PropertyStore implementation using RedisHash?
I'm working to get ff4j working with spring boot, and have had success using the ff4j-store-redis implementation, but it was suggested that I try and use RedisHash annotation provided by spring-data-redis to establish the redis connection and manage feature entities. How difficult would this be to re-implement?
I can't exactly add the @RedisHash annotation to the Feature class, and I have no idea if subclassing it and applying the annotation will work the way I expect. I'm also not sure how I'd re-implement the feature and property stores using CrudRepositories considering the relationship between Feature and Property, how they're handled separately and mapped together by ff4j.
RedisHash
is a different way to store data in redis. To have it working with spring-data-redis
here are the different operations to do:
- Create FeatureStore, PropertyStore and AuditRepository classes same as the one you can see here.
- Create dedicated beans associated to
Feature
,Property
andEvent
, annotated with@RedisHash
. The repository spring data repository would work with the annotated bean and then manual mapping would recreate public Feature, Property and Event. - You do not want to change and subclasses the objects in public interfaces as they are used everywhere including API and Http clients.
I think those classes could be part of the ff4j-store-redis
. We would reviewed a pull request in that direction but will not implement it.