-
Notifications
You must be signed in to change notification settings - Fork 82
Added subscriber options to HttpCache #178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added subscriber options to HttpCache #178
Conversation
9a84864 to
becf79c
Compare
HttpCache.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it need to be public ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Did it for testing purpose, but I could use Reflection in the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Reflection then. Turning a private method into a public one just for testing purpose is bad, because public methods are affected by BC while private are not.
|
thanks, looks good. i will add your PR doc into the .rst doc, once we merged this. so we need to figure out the options / init question. |
|
Hmmm, it seems that conflicts appeared suddenly... Tell me when you're finished with modifications in your branch :-) |
becf79c to
8d24706
Compare
|
Rebased on your branch @dbu (solved conflicts that appeared after your last update).
|
SymfonyCache/HttpCache.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would prefer to remove this option and only keep the bitmap.
creating those subscribers should be done outside the kernel, or can be done in the constructor. there is no benefit in the indirection that i can see.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or the user can overwrite getSubscribers to add his own subscribers, instead of the constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I'll remove the option then. Documentation should state that one can add custom subscribers by overriding getSubscribers().
|
i updated my branch from the feedback from stof. i will leave it alone now until this is merged, to avoid further conflicts :-) can we "compromise" on using the options bitmap only for default subscribers, and leave it to the user to do custom subscribers in getSubscribers or the constructor, or the frontend controller? |
Based on FriendsOfSymfony#177, ref FriendsOfSymfony#170 This PR adds 1 option that one can add in their `getOptions()`: * `fos_native_subscribers`: bit options to activate/deactivate subscribers provided by FOSHttpCacheBundle > By default **all native subscribers are activated** (`HttpCache::SUBSCRIBER_ALL`). **ALL native subscribers EXCEPT the user context one** ```php public function getOptions() { return [ 'fos_native_subscribers' => self::SUBSCRIBER_ALL | ~self::SUBSCRIBER_USER_CONTEXT ] } ``` **NO native subscribers** ```php public function getOptions() { return [ 'fos_native_subscribers' => self::SUBSCRIBER_NONE ] } ``` **ONLY user context subscribers** ```php public function getOptions() { return [ 'fos_native_subscribers' => self::SUBSCRIBER_USER_CONTEXT ] } ``` **User context subscriber AND Foo subscriber** ```php public function getOptions() { return [ 'fos_native_subscribers' => self::SUBSCRIBER_USER_CONTEXT | self::SUBSCRIBER_FOO ] } ```
8d24706 to
17a923c
Compare
Added subscriber options to HttpCache
|
great, thanks a lot! i merged it into my branch so that we can discuss in one place again :-) |
|
So cool ! Thanks for merging 👍 |
|
thanks for the contribution! |
Based on #177, ref #170
This PR adds 2 options that one can add in their
getOptions():fos_native_subscribers: bit options to activate/deactivate subscribers provided by FOSHttpCacheBundleExamples with
fos_native_subscribersALL native subscribers EXCEPT the user context one
NO native subscribers
ONLY user context subscribers
User context subscriber AND Foo subscriber