-
Notifications
You must be signed in to change notification settings - Fork 150
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
Add second option for CACHALOT_CACHABLE_TABLES in a db router #153
Comments
This unfortunately isn't really solved with #187. The proposal was to add a wildcard but I thought that degrade performance. I'll run a benchmark against both options, but I'm pretty sure it's not going to go well. The problem with the wildcard solution is how are we actually supposed to filter out which tables go into cachable and uncachable. I suppose we could do that in the settings beforehand (i.e. load all the tables, then do a final check by filtering out all those wildcards). Besides that, I think the callable would degrade performance too much and thus a wildcard would in fact be a better solution. |
We can use something like fnmatch to quickly do wildcard matches, but this isn't as versatile as regex for sure. Again, it's down to that performance issue. Key factors:
|
Another strategy is to 1. use fnmatch and 2. allow regex OBJECTS (not string values). It's as simple as doing isinstance(searchable, str) to determine whether to use fnmatch or else we know that the next object must be a regex object. But should we compile all regex values? Yes without a doubt... maybe we can combine two settings objects as well so that people CAN use just strings without importing regex. The thing is, doesn't regex have some global value? Ok so maybe we do need the user to first compile their regex values first. I think based on a name like We have to use compiled regex objects that the user does themselves because we search those tables quite frequently... like a lot a lot. And the reason strings values themselves don't work is because people like to add flags too. |
This issue is linked to the "Integrating Architect with Cachalot" project. This project is meant to help integrate dynamic table caching.
The text was updated successfully, but these errors were encountered: