Baldinof / roadrunner-bundle

A RoadRunner worker integrated in your Symfony app
MIT License
266 stars 47 forks source link

Shared cache between workers #35

Open skekec1 opened 3 years ago

skekec1 commented 3 years ago

Hi everyone,

i have a question about Roadrunner and symfony and its behaviour regarding caching:

We are currently using symfony with two caching adapters in this order: array,redis

We noticed that this causes some problems and we get out-dated values from the cache. Are we right with our assumption that this is caused by none shared caches on the array level, so that all workers accessing their own representation and values?

If this is the case:

Thanks in advance!

Selcuk

Baldinof commented 3 years ago

Hi! Thanks for using this bundle :)

I am not aware of a way to share memory between php cli scripts.

If you can afford some out dated data, I would recommend to simply reduce the expiration time of your items.

Otherwise you will be required to rely only on redis.

Maybe it's possible to setup something to keep data in array but invalidate via tags stored in redis, with https://symfony.com/doc/current/components/cache/cache_invalidation.html#tag-aware-adapters

[Edit]

It seems that something is already there on the RoadRunner side: https://github.com/spiral/roadrunner/tree/master/plugins/kv

I have no time to work on this for now, but I would be happy to merge a PR :)

wolfy-j commented 3 years ago

Hey, RR has new KV plug-in and SDK for it. You can use it for caching. :)

Baldinof commented 3 years ago

Yeah, I will find time to integrate it with Symfony :)

StanJansen commented 7 months ago

@Baldinof I see that this hasn't been done yet, I created a PR for this: https://github.com/Baldinof/roadrunner-bundle/pull/137