131 time_t freshness_lifetime;
132 time_t response_time;
133 time_t corrected_initial_age;
135 bool must_revalidate;
139 pthread_mutex_t d_response_lock;
140 pthread_mutex_t d_response_write_lock;
144 friend class HTTPCacheTest;
147 friend class DeleteCacheEntry;
148 friend class WriteOneCacheEntry;
149 friend class DeleteExpired;
150 friend class DeleteByHits;
151 friend class DeleteBySize;
154 string get_cachename()
174 void set_size(
unsigned long sz)
178 time_t get_freshness_lifetime()
180 return freshness_lifetime;
182 time_t get_response_time()
184 return response_time;
186 time_t get_corrected_initial_age()
188 return corrected_initial_age;
190 bool get_must_revalidate()
192 return must_revalidate;
194 void set_no_cache(
bool state)
203 void lock_read_response()
205 DBG(cerr <<
"Try locking read response... (" << hex << &d_response_lock << dec <<
") ");
206 int status = TRYLOCK(&d_response_lock);
209 LOCK(&d_response_write_lock);
210 UNLOCK(&d_response_write_lock);
215 DBGN(cerr <<
"Done" << endl);
219 void unlock_read_response()
223 DBG(cerr <<
"Unlocking read response... (" << hex << &d_response_lock << dec <<
") ");
224 UNLOCK(&d_response_lock); DBGN(cerr <<
"Done" << endl);
228 void lock_write_response()
230 DBG(cerr <<
"locking write response... (" << hex << &d_response_lock << dec <<
") ");
231 LOCK(&d_response_lock);
232 LOCK(&d_response_write_lock); DBGN(cerr <<
"Done" << endl);
235 void unlock_write_response()
237 DBG(cerr <<
"Unlocking write response... (" << hex << &d_response_lock << dec <<
") ");
238 UNLOCK(&d_response_write_lock);
239 UNLOCK(&d_response_lock); DBGN(cerr <<
"Done" << endl);
243 url(
""), hash(-1), hits(0), cachename(
""), etag(
""), lm(-1), expires(-1), date(-1), age(-1), max_age(-1), size(
244 0), range(
false), freshness_lifetime(0), response_time(0), corrected_initial_age(0), must_revalidate(
245 false), no_cache(
false), readers(0)
247 INIT(&d_response_lock);
248 INIT(&d_response_write_lock);
251 url(u), hash(-1), hits(0), cachename(
""), etag(
""), lm(-1), expires(-1), date(-1), age(-1), max_age(-1), size(
252 0), range(
false), freshness_lifetime(0), response_time(0), corrected_initial_age(0), must_revalidate(
253 false), no_cache(
false), readers(0)
255 INIT(&d_response_lock);
256 INIT(&d_response_write_lock);
359 void calculate_time(HTTPCacheTable::CacheEntry *entry,
int default_expiration, time_t request_time);