Closed anapaulalemos closed 1 year ago
I suggested to have cache on federated services and on the gateway, and to use invalidation on them, so redis is needed to share the cache between them, and to keep the cache consistent by the invalidation, so invalidating entries on the federated services on writings (create post in this case) automatically invalidates the entries on the gateway too.
We can go with simple solution, but imo can be more significant using invalidation
@brainrepo can you please review this PR?
This example doesn't work properly, there's no invalidation on the gateway.
Calling topPosts
, then createPosts
, then topPosts
again, you get the old values.
This example doesn't work properly, there's no invalidation on the gateway.
Calling
topPosts
, thencreatePosts
, thentopPosts
again, you get the old values.
Fixed. I also changed all the references
for the sake of simplicity.
I don't agree with the fix, removing the cache from gateway works, of course, but this is not the target of providing an example for the cache feature.
The example should be a showcase of "how to use the cache in a federated scenario", and we can achieve that through invalidation, adopting the cache on the gateway and on the federated services.
can you please rebase this PR on top of master? it's missing some changes that were merged previously
Closes #82