dragonfly
dragonfly copied to clipboard
Java Integration
Java Integration. Hey Dragonfly owners, would you mind writing a client for this library in Java? or will you support this implementation if someone like to do it?
Use in JVM-based server framework As you know Java and JVM-based languages have many powerful web frameworks, I think it will be helpful if we can provide a way to use this library in these frameworks with a standalone Client like spring-data-redis.
Hi @aabolfazl and thank you for opening an issue.
Dragonfly is redis API compatible (we don't yet support all the currently existing commands, but most of them should be available) which means that third party client libraries should work outside of the box.
Did you have any issue using Dragonfly with any of the already existing client libraries?
@kostasrim
From what you mentioned above, I think there will be no problem if it is integrated to the redis client(like spring-data-redis) api.
i will actually test it after building on AWS. If there is a problem in the future, I will register the issue.
@aabolfazl
I am also a Java developer, so I became interested in the question you wrote. And i did a brief test with reference to what @kostasrim said above.
repository : https://github.com/brewagebear/counter-api
sample code
- CacheService.java
@Service
public class CacheService {
@CachePut(cacheNames = "namespace", key="#namespace")
public int updateNamespace(String namespace, Map<String, String> data) {
return 1;
}
}
- CacheController
@RestController
@RequestMapping("/api")
public class CacheController {
private final CacheService cacheService;
public CounterController(CacheService cacheService) {
this.cacheService = cacheService;
}
@GetMapping("/test")
public void cache() {
cacheService.updateNamespace("test", Map.of("test", "1"));
}
}
result
It's a very simple test, so I think I need to check if other APIs are compatible well, but if there's a problem with this part, I'll check and create an issue.
First of all, i confirmed that it works normally in a simple test.
To conclude - we support Redis client libraries out of the box. Feel free to open a specific issue if you stumble upon any problem.