https://github.com/free-pixel/jredom
A lightweight and open-sourced Redis ORM experiment.
https://github.com/free-pixel/jredom
java-client jredom lightweight maven redis-cache redis-orm
Last synced: 6 months ago
JSON representation
A lightweight and open-sourced Redis ORM experiment.
- Host: GitHub
- URL: https://github.com/free-pixel/jredom
- Owner: free-pixel
- License: mit
- Created: 2025-04-21T09:46:19.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-05-07T22:31:02.000Z (8 months ago)
- Last Synced: 2025-05-11T19:33:55.679Z (8 months ago)
- Topics: java-client, jredom, lightweight, maven, redis-cache, redis-orm
- Language: Java
- Homepage:
- Size: 88.9 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## About JRedom (Experimental / Beta)
[](http://makeapullrequest.com)







This Redis ORM solution is currently a temporary one. It is more of an implementation based on "convention." It is simple enough, flexible enough, and you can even directly copy the code without needing to include a jar file.
## Maybe the solution
1、basicly implementation a simple redis orm lib
our goal is implement one redis orm lib, when you change your db data, the redis
case sync at once, at the same time keep the code simple and clean.
there are three plan to slove the problem
1、use event driver, the event framework we use spring-event, when database changed, the change method send one event notify the redis listener to sync redis
2、make redis-orm as a annotion, when db method invoked, the orm code at time work,but i don't like to use annotation, it make the code understand complex.
3、use mybatis interceptor, when db update param equals EntityWithId, we can invoke the sync code
4、use inner function, like the mask code :
```java
@Transactional
public User updateUser(User user, function funcRedisOrm) {
// 1. Update MySQL
userMapper.update(user);
// 2. Update Redis
funcRedisOrm();
return use;
}
```
this plan like use the proxy pattern to solve the problem.
summary: the only problem is how to control the invoke time, and the invoke mechanism.
synchronous call ;synchronized call 。
## add protobuf serial/deserial object
you can use spring manager your serial type, default is json, you can change to protobuf.
```java
@Configuration
public class RedisConfig {
@Bean
public RedisCacheManager redisCacheManager(RedisTemplate redisTemplate) {
RedisCacheManager manager = new RedisCacheManager();
manager.setSerializationType(RedisCacheManager.SerializationType.PROTOBUF); // 或JSON
return manager;
}
}
```
## Quick Start
You can follow the user guide [here](./docs/jredom-quick-start.en.md).
## Background and Motivation
- [English](docs/background-and-motivation-for-the-project.en.md)
- [简体中文](docs/background-and-motivation-for-the-project.zh-CN.md)
- [繁體中文](docs/background-and-motivation-for-the-project.zh-Hant.md)
- [日本語](docs/background-and-motivation-for-the-project.ja.md)
## License
This project is licensed under the [MIT License](./LICENSE).
Copyright (c) 2025 Free Pixel Games