Skip to content
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

Flag BaseCacheManager methods as virtual to allow overrides. #280

Open
jthope opened this issue Jul 4, 2019 · 2 comments
Open

Flag BaseCacheManager methods as virtual to allow overrides. #280

jthope opened this issue Jul 4, 2019 · 2 comments

Comments

@jthope
Copy link

jthope commented Jul 4, 2019

I am wrapping the BaseCacheManager<> object to customize key values. Several methods allow overrides (Get, Put, Add, etc). However, there are some really nice helper methods that cannot be overridden.

Example of the wrapper in an external project:
image

Example do flagging addtl helper methods in BaseCacheManager as virtual:
image

Since I am new to the project, I may be overlooking something. But my goal is to modify the key before any cache requests. At first thought, hooking into the various events for cache operations (OnAdd, OnRemove, etc) I could do this, but they key is readonly here, and that's probably a safety measure. Do you see any issue with marking the additional caching methods in the BaseCacheManager class as virtual?

I could submit a PR if not. I only have a few hours of familiarity with this project, so I don't know the implications this may have on the design strategy of the CacheManager project.

@MichaCo
Copy link
Owner

MichaCo commented Jul 5, 2019

Hi @jthope,
I think you actually only have to override the 4 protected methods for Get/Put/Add/Delete Internal. Those methods are invoked from basically everything else.
Except, updates. Those work slightly different and for some reason are not virtual/protected. I guess if you need those, too, I wouldn't disagree to change the access level for those.

@jthope
Copy link
Author

jthope commented Jul 5, 2019

I will take a look, thank your for the quick reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants