Can't cache Page objects with redis
See original GitHub issueI’ve ran into this trying to cache a queryset of Page models using redis as backend cache:
PicklingError at /
Can't pickle <class 'wagtail.wagtailcore.blocks.base.ChoiceBlockMeta'>: attribute lookup wagtail.wagtailcore.blocks.base.ChoiceBlockMeta failed
Request Method: GET
Request URL: http://localhost:8111/
Django Version: 1.8.4
Exception Type: PicklingError
Exception Value:
Can't pickle <class 'wagtail.wagtailcore.blocks.base.ChoiceBlockMeta'>: attribute lookup wagtail.wagtailcore.blocks.base.ChoiceBlockMeta failed
Exception Location: /home/vagrant/.virtualenvs/project/local/lib/python2.7/site-packages/redis_cache/cache.py in set, line 239
Python Executable: /home/vagrant/.virtualenvs/project/bin/python
Python Version: 2.7.6
Python Path:
['/home/vagrant/project',
'/home/vagrant/.virtualenvs/project/lib/python2.7',
'/home/vagrant/.virtualenvs/project/lib/python2.7/plat-i386-linux-gnu',
'/home/vagrant/.virtualenvs/project/lib/python2.7/lib-tk',
'/home/vagrant/.virtualenvs/project/lib/python2.7/lib-old',
'/home/vagrant/.virtualenvs/project/lib/python2.7/lib-dynload',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-i386-linux-gnu',
'/usr/lib/python2.7/lib-tk',
'/home/vagrant/.virtualenvs/project/local/lib/python2.7/site-packages',
'/home/vagrant/project',
'/home/vagrant/project']
Server time: Thu, 3 Dec 2015 14:07:16 +1300
Looks like something’s wrong with the serializer?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:4
- Comments:9 (7 by maintainers)
Top Results From Across the Web
Using Redis as a Persistent Object Cache - Kinsta
Redis can be used to store values generated by WordPress' native object cache in a persistent manner so that cached objects can be...
Read more >Enabling Redis Object Caching - Nexcess
Redis object caching is enabled by default on all new sites. We automatically install the Object Cache Pro plugin to do this. Steps...
Read more >Troubleshoot | Object Cache (formerly Redis) | Pantheon Docs
Drupal instructs Redis to dump cached items that are CACHE_TEMPORARY (versus PERM or a specified time) when cron runs, which causes the busy...
Read more >Issue with redis object caching - WordPress.org
I can't see any reason why this issue happens. The plugin is mostly using core functions and do not interact on the caching...
Read more >Redis and Object Caching - WP Rocket Knowledge Base
Benefits of object caching. This can help pages that can't be page cached by WP Rocket: The backend of your WordPress site; Front-end...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ve created a “fix” which works for me without any issues, can others verify if it works properly for them?
https://github.com/wagtail/wagtail/compare/master...WoLpH:pickle-fix
Nah, solution provided by @WoLpH no longer works most of the time. Issues like the following arises:
AttributeError: Can't pickle local object 'ChoiceBlock.get_callable_choices.<locals>.choices_callable'