benoitdm-oslandia / pg_featureserv

Apache License 2.0
1 stars 0 forks source link

Task - create a version of the cache shared between servers and based on redis #89

Closed benoitdm-oslandia closed 1 year ago

benoitdm-oslandia commented 2 years ago

Create a cache exploiting redis

In the case of a deployment with horizontal scalability, the cache will be different from one instance to another. To overcome this problem, we can use a Redis instance which will store the cache!

Useful links

Steps

Install a Redis server

Update configuration

Set up an implementation logic

image

[GET] :
if the data is not available either in the Redis cache or in the database, we save the information of non-existence in the Redis cache

image

[POST] :
we always save new data in the Redis cache

[PATCH | PUT] :
save the data modification in the Redis cache, by overwriting the old cache

:eye_speech_bubble: Redis stores keys/values

  • Ex. etag: {...} // réponse json d'une collection

:eye_speech_bubble: where to add the redis instructions?

we will use the available Cacher interface

Implement the new Cacher interface RedisCache

cf. comment: implementation examples

Add unit test

Benchmark

Implementation internal to the project

benoitdm-oslandia commented 2 years ago

cloned from #77

benoitdm-oslandia commented 1 year ago

marked this issue as related to #77

benoitdm-oslandia commented 1 year ago

marked this issue as related to #11