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
[PATCH]Add FastDbfilenameShelf: shelf nerver sync cache even when writeback=True #49733
Comments
shelf without writeback=True is too slow, while shelves with $ cat test_shelve.py
#!/usr/bin/env python import shelve
store = shelve.open("/tmp/shelve.db", writeback=True)
class Test(object):
pass
def main():
store["a"] = Test()
if __name__ == '__main__':
main() $ python test_shelve.py
Exception cPickle.PicklingError: "Can't pickle <class '__main__.Test'>:
it's not the same object as __main__.Test" in ignored With this module, we can make it to run. I think it's worth add this function to shelve. We can achieve great The other approach to add this function is to add a extra option the |
Add some errata of the patch: add the new class to __all__. |
If I understand you correctly, your proposal is the following: use I do not think this is a feasible solution for two reasons: I'm -1 on this patch but generally +1 on a generic caching wrapper. The error you describe later on appears because Python is already |
Thanks Robert for pointing out bpo-553171. After read that issue, I still think we paid too much to make shelf less We should at lease provide a option for the *smart* programmers to get The write-back-all-cache-on-close feature is easy to document, but hard CCing Alex and Martin for comments. |
I addressed the other bug you were experiencing in bpo-6932. |
I agree that caching for speed is something that should be implemented in another layer. It certainly is orthogonal to the writeback issue. The best caching strategy is going to depend on the application, so I don't think caching for speed belongs in Shelve itself. Closing as rejected. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: