@@ -28,12 +28,12 @@ def __init__(self, cache=None,
28
28
serializer = serializer ,
29
29
)
30
30
31
- def send (self , request , ** kw ):
31
+ def send (self , request , cacheable = ( 'GET' ,), ** kw ):
32
32
"""
33
33
Send a request. Use the request information to see if it
34
34
exists in the cache and cache the response if we need to and can.
35
35
"""
36
- if request .method == 'GET' :
36
+ if request .method in cacheable :
37
37
cached_response = self .controller .cached_request (request )
38
38
if cached_response :
39
39
return self .build_response (request , cached_response ,
@@ -48,14 +48,15 @@ def send(self, request, **kw):
48
48
49
49
return resp
50
50
51
- def build_response (self , request , response , from_cache = False ):
51
+ def build_response (self , request , response , from_cache = False ,
52
+ cacheable = ('GET' ,)):
52
53
"""
53
54
Build a response by making a request or using the cache.
54
55
55
56
This will end up calling send and returning a potentially
56
57
cached response
57
58
"""
58
- if not from_cache and request .method == 'GET' :
59
+ if not from_cache and request .method in cacheable :
59
60
# Check for any heuristics that might update headers
60
61
# before trying to cache.
61
62
if self .heuristic :
0 commit comments