문제

We are trying to implement caching through Redis I understand that it stores data into its own format RDB files. But we already have Oracle persistence which is used by other clients. So instead of storing in RDB files we would like to persist the data in Oracle DB.

도움이 되었습니까?

해결책

Disable the file writing in this case, and use Redis as a pure in-memory cache. To do it just comment all the "save" lines in redis.conf.

In pseudo code, reading a value should be done like this:

result = get value from redis
if(result is null)
{
   result = get value from Oracle
   store result in redis
}
return result

Update: after some exchange in comments here is an alternative

Create a fake redis slave, which will connect to the Redis instance and then reproduce the write operations on the Oracle database. Look at redis documentation to see how replication works.

But it's not a trivial thing to do. You'll have to interpret Redis commands and apply corresponding SQL commands, and handle resynchronization when the Oracle Database fails. The performances will depend on the number of write operations. If they are too numerous, the Oracle database could not be able to cope with them. So once again, I don't think it's a recommended architecture.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top