pg-redis-fdw / redis_fdw

A PostgreSQL foreign data wrapper for Redis
494 stars 68 forks source link

question about redis_wrapper as foreign server #33

Open DeoLeung opened 2 years ago

DeoLeung commented 2 years ago

Hi, I want to comment redis_wrapper but the issue button is grey :(

I want to use it as a trigger to sync db data into redis as cache.

In such scenario, it will be great if the redis server could be implemented as foreign server instead of connect/disconnect functions.

Is there any plan to support this feature or is there any workaround to achieve it at the moment?

Why redis_fdw can't be used is that we have hashes like account:$id for each row in table account, using redis_fdw needs to create foreign table each time :(

Thanks

DeoLeung commented 2 years ago

argh I played around it and found that redis_connect shall be creating a connection in pool :)

create extension redis;
select redis_connect(0, 'localhost', 6379, '', 0);
select redis_command_argv(0, 'SET', 'from_db', 'hahahha');
select redis_command_argv(0, 'GET', 'from_db');

another question, will it do auto reconnect and persist across session/connection? if so I can just open it once and leave it running forever :)