-
Notifications
You must be signed in to change notification settings - Fork 137
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
allow unpickling failures to be treated as cache misses #96
Comments
This makes sense to me. |
I'm wondering if a subclass is maybe a better idea? |
How would you go about subclassing in order to unambiguously turn unpickling issues into cache misses? |
The problem I ran into is that since the unpickling code is inside the C module, it's sort of inaccessible to customization. If the issue is that another configuration variable would be too crufty, perhaps pylibmc could define a special |
bump |
I'm not going to wrap all exceptions in a parent exception because that sucks. |
Could you address my question please?
(Disclaimer: This is not a rant, I'm just trying to be very clear, and avoid confusion.) I believe we could wrap Even if we disregarded that issue, So I wonder how we'd do this with subclassing. I think we solve the above issues in a fairly neat way if we simply refactor Would you accept this kind of patch? Can you give tips on the best way to do it? |
Incidentally, exposing overridable methods solves #75 in a much neater way: people that prefer json can override their client to use json for serialization, assuming that you similarly refactor |
Consider the following scenario:
AttributeError
).One natural response to this would be to treat the cache retrieval as a miss. However, implementing this against the current pylibmc behavior is somewhat awkward and difficult. Every call to
_pylibmc.Client.get
must be wrapped in a try-except that distinguishes_pylibmc.MemcachedError
(problems with remote memcached) from other exception types (unpickling failures).Would it make sense to submit a patch to pylibmc adding a configuration switch such that if it is enabled,
_pylibmc.Client.get
responds to an unpickling error by suppressing it and returningNone
, as in the case of a miss?The text was updated successfully, but these errors were encountered: