Skip to content
Browse files

dont cache things without a body or fear the wrath of the spinning br…

…owser
  • Loading branch information...
1 parent 0cc1295 commit dd60cecd1d9586e406a9a7fdc59d42c9bf83a40b @spanktar spanktar committed Mar 10, 2012
Showing with 16 additions and 2 deletions.
  1. +3 −2 CHANGES.txt
  2. +13 −0 plone/app/caching/operations/utils.py
View
5 CHANGES.txt
@@ -3,8 +3,9 @@ Changelog
1.0.2 (unreleased)
~~~~~~~~~~~~~~~~~~
-
-- Nothing changed yet.
+- Handle caching of resource registries in RAM cache by not storing empty
+ bodies in the RAMCache
+ [eleddy with major tseaver support]
1.0.1 (2012-01-26)
View
13 plone/app/caching/operations/utils.py
@@ -680,6 +680,19 @@ def storeResponseInRAMCache(request, response, result, globalKey=PAGE_CACHE_KEY,
cache = getRAMCache(globalKey)
if cache is None:
return
+
+ """
+ Resource registries have no body. If we put them in the cache the content
+ type headers will indicate length and the body will be '', causing the browser
+ to just spin. Furthermore, I doubt we ever want to cache an empty result:
+ it's an indication that something went wrong somewhere.
+
+ This does mean that any resources will not be cached in ram. There is
+ potentially another fix but I doubt long term it's ever the right thing to
+ do.
+ """
+ if result == '':
+ return
status = response.getStatus()
headers = dict(request.response.headers)

0 comments on commit dd60cec

Please sign in to comment.
Something went wrong with that request. Please try again.