rvanlaak / SettingsBundle

Database centric Symfony2 configuration management bundle. Global and per-entity settings supported.
MIT License
113 stars 61 forks source link

Ensure long running PHP processes are notified of setting changes #99

Closed talisman-innovations closed 7 years ago

talisman-innovations commented 7 years ago

When using the cache, for example redis, long running PHP processes are made aware when a setting is saved. This is due to the cache being invalidated on save. However if this happens the bundle will reload the setting from the global and user settings, rather than from the DB. This means the previous, now incorrect setting will be loaded.

The following patch ensures that the the cache is empty then the global or user setting is removed from local storage forcing the information to be pulled from the DB, refilling the cache correctly for call other clients. Impact is very small with a decent cache lifetime and long running processes are kept in sync.

talisman-innovations commented 7 years ago

This isn’t a complete solution so I’m closing this and looking for a better one.

jongotlin commented 5 years ago

Did you find any solution for this @stevenbrookes?

stevenbrookes commented 5 years ago

I'm using the solution I posted. Not sure why it's not complete...@jongotlin

jongotlin commented 5 years ago

I was about to use a similar solution when I say your pr. Any chance this can be merged @dmishh @Nyholm ?

Nyholm commented 5 years ago

Sure.

@stevenbrookes It is not complete because it always clears the cache. It should probably implement Symfonys: ResetableInterface so cache gets cleared when rebooting the kernel.