Skip to content

Create Indexes using single class and multiple Configuration #332

Open
@rpjtesting

Description

@rpjtesting

Hi there,

I have a single class called RedisEntityClass having following fields present:

class RedisEntityClass {
String field1;
String field2:
String field3;
}

With below cache configurations:
Cache1:
field1: val11
field2: val12
field3: val13

Cache2:
field1: val21
field2: val22
field3: val23

.. and so on.

I need to create Json Documents for all above caches using single Java Class as the structure for all the caches is same, hence I don't want to create similar Java classes as well for all the cache configurations.

I think it can work by creating a class for each cache with different names and extend to RedisEntityClass like below:

@document("cache1:")
class Cache1 extends RedisEntityClass {}
@document("cache2:")
class Cache2 extends RedisEntityClass {}
.... and so on.

This may work, but I have thousands of such caches and I don't want to create empty classes for each cache like this.

Is it possible to provide a feature in RedisOM-Spring library which will take input the above config data, map it to single entity class like RedisEntityClass, and create indexes for all the caches at once.

Currently I have copied the library code and tweaked a little to meet the requirements, but I know this is not the good approach in long run :(

Please help me with this :)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions