Changeset 1184
- Timestamp:
- 07/05/06 13:25:43
- Files:
-
- trunk/cherrypy/lib/caching.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/lib/caching.py
r1163 r1184 61 61 62 62 def get(self): 63 """ 64 If the content is in the cache, returns a tuple containing the 65 expiration time, the lastModified response header and the object 66 (rendered as a string); returns None if the key is not found. 67 """ 63 """Return the object if in the cache, else None.""" 68 64 self.totGets += 1 69 65 cacheItem = self.cache.get(self.key, None) … … 74 70 return None 75 71 76 def put(self, lastModified,obj):72 def put(self, obj): 77 73 # Size check no longer includes header length 78 74 objSize = len(obj[2]) … … 88 84 objKey = self.key 89 85 self.expirationQueue.put((expirationTime, objSize, objKey)) 90 self.cache[objKey] = (expirationTime, lastModified, obj)86 self.cache[objKey] = obj 91 87 self.totPuts += 1 92 88 self.cursize += objSize … … 113 109 114 110 if c: 115 expirationTime, lastModified, obj = cacheData 116 s, cherrypy.response.header_list, b = obj 111 s, cherrypy.response.header_list, b = cacheData 117 112 try: 118 113 cptools.validate_since() … … 141 136 if response.headers.get('Pragma', None) != 'no-cache': 142 137 # save the cache data 143 lastModified = response.headers.get('Last-Modified', None)144 138 body = ''.join([chunk for chunk in output]) 145 cherrypy._cache.put(lastModified, 146 (response.status, response.header_list, body)) 139 cherrypy._cache.put((response.status, response.header_list, body)) 147 140 response.body = tee(response.body) 148 141

