Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > f149f58f4a75af135bdb24f5dfe94165 > files > 247

libdap-doc-3.9.3-3mdv2010.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>libdap++: HTTPCache.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css">
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.9 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<h1>HTTPCache.h</h1><a href="HTTPCache_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00002"></a>00002 <span class="comment">// -*- mode: c++; c-basic-offset:4 -*-</span>
<a name="l00003"></a>00003 
<a name="l00004"></a>00004 <span class="comment">// This file is part of libdap, A C++ implementation of the OPeNDAP Data</span>
<a name="l00005"></a>00005 <span class="comment">// Access Protocol.</span>
<a name="l00006"></a>00006 
<a name="l00007"></a>00007 <span class="comment">// Copyright (c) 2002,2008 OPeNDAP, Inc.</span>
<a name="l00008"></a>00008 <span class="comment">// Author: James Gallagher &lt;jgallagher@opendap.org&gt;</span>
<a name="l00009"></a>00009 <span class="comment">//</span>
<a name="l00010"></a>00010 <span class="comment">// This library is free software; you can redistribute it and/or</span>
<a name="l00011"></a>00011 <span class="comment">// modify it under the terms of the GNU Lesser General Public</span>
<a name="l00012"></a>00012 <span class="comment">// License as published by the Free Software Foundation; either</span>
<a name="l00013"></a>00013 <span class="comment">// version 2.1 of the License, or (at your option) any later version.</span>
<a name="l00014"></a>00014 <span class="comment">//</span>
<a name="l00015"></a>00015 <span class="comment">// This library is distributed in the hope that it will be useful,</span>
<a name="l00016"></a>00016 <span class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00017"></a>00017 <span class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
<a name="l00018"></a>00018 <span class="comment">// Lesser General Public License for more details.</span>
<a name="l00019"></a>00019 <span class="comment">//</span>
<a name="l00020"></a>00020 <span class="comment">// You should have received a copy of the GNU Lesser General Public</span>
<a name="l00021"></a>00021 <span class="comment">// License along with this library; if not, write to the Free Software</span>
<a name="l00022"></a>00022 <span class="comment">// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA</span>
<a name="l00023"></a>00023 <span class="comment">//</span>
<a name="l00024"></a>00024 <span class="comment">// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.</span>
<a name="l00025"></a>00025 
<a name="l00026"></a>00026 <span class="preprocessor">#ifndef _http_cache_h</span>
<a name="l00027"></a>00027 <span class="preprocessor"></span><span class="preprocessor">#define _http_cache_h</span>
<a name="l00028"></a>00028 <span class="preprocessor"></span>
<a name="l00029"></a>00029 <span class="preprocessor">#include &lt;pthread.h&gt;</span>
<a name="l00030"></a>00030 
<a name="l00031"></a>00031 <span class="preprocessor">#ifdef WIN32</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span><span class="preprocessor">#include &lt;io.h&gt;</span>   <span class="comment">// stat for win32? 09/05/02 jhrg</span>
<a name="l00033"></a>00033 <span class="preprocessor">#endif</span>
<a name="l00034"></a>00034 <span class="preprocessor"></span>
<a name="l00035"></a>00035 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00036"></a>00036 <span class="preprocessor">#include &lt;vector&gt;</span>
<a name="l00037"></a>00037 <span class="preprocessor">#include &lt;map&gt;</span>
<a name="l00038"></a>00038 
<a name="l00039"></a>00039 <span class="preprocessor">#ifndef _http_cache_table_h</span>
<a name="l00040"></a>00040 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="HTTPCacheTable_8h.html">HTTPCacheTable.h</a>"</span>
<a name="l00041"></a>00041 <span class="preprocessor">#endif</span>
<a name="l00042"></a>00042 <span class="preprocessor"></span>
<a name="l00043"></a>00043 <span class="preprocessor">#ifndef _error_h</span>
<a name="l00044"></a>00044 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="Error_8h.html">Error.h</a>"</span>
<a name="l00045"></a>00045 <span class="preprocessor">#endif</span>
<a name="l00046"></a>00046 <span class="preprocessor"></span>
<a name="l00047"></a>00047 <span class="preprocessor">#ifndef _internalerr_h</span>
<a name="l00048"></a>00048 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="InternalErr_8h.html">InternalErr.h</a>"</span>
<a name="l00049"></a>00049 <span class="preprocessor">#endif</span>
<a name="l00050"></a>00050 <span class="preprocessor"></span>
<a name="l00051"></a>00051 <span class="preprocessor">#ifndef _debug_h</span>
<a name="l00052"></a>00052 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="debug_8h.html">debug.h</a>"</span>
<a name="l00053"></a>00053 <span class="preprocessor">#endif</span>
<a name="l00054"></a>00054 <span class="preprocessor"></span>
<a name="l00055"></a>00055 <span class="comment">// The private method HTTPCache::write_body() could, at one time, throw</span>
<a name="l00056"></a>00056 <span class="comment">// ResponseTooBig to signal that while writing a response body it was found</span>
<a name="l00057"></a>00057 <span class="comment">// to be bigger than the max_entry_size property. But I bagged that; the</span>
<a name="l00058"></a>00058 <span class="comment">// garbage collection methods remove entries larger than max_entry_size. It</span>
<a name="l00059"></a>00059 <span class="comment">// might be that a really big entry belongs in the cache so long as it</span>
<a name="l00060"></a>00060 <span class="comment">// doesn't push other entries out. 10/07/02 jhrg</span>
<a name="l00061"></a>00061 <span class="preprocessor">#ifndef _response_too_big_err_h</span>
<a name="l00062"></a>00062 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="ResponseTooBigErr_8h.html">ResponseTooBigErr.h</a>"</span>
<a name="l00063"></a>00063 <span class="preprocessor">#endif</span>
<a name="l00064"></a>00064 <span class="preprocessor"></span>
<a name="l00065"></a>00065 <span class="preprocessor">#ifndef _http_cache_disconnected_mode_h</span>
<a name="l00066"></a>00066 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="HTTPCacheDisconnectedMode_8h.html">HTTPCacheDisconnectedMode.h</a>"</span>
<a name="l00067"></a>00067 <span class="preprocessor">#endif</span>
<a name="l00068"></a>00068 <span class="preprocessor"></span>
<a name="l00069"></a>00069 <span class="preprocessor">#ifndef _signal_handler_registered_err_h</span>
<a name="l00070"></a>00070 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="SignalHandlerRegisteredErr_8h.html">SignalHandlerRegisteredErr.h</a>"</span>
<a name="l00071"></a>00071 <span class="preprocessor">#endif</span>
<a name="l00072"></a>00072 <span class="preprocessor"></span>
<a name="l00073"></a><a class="code" href="HTTPCache_8h.html#16e4e2643dc8f8b07b8be8bebd189ad5">00073</a> <span class="preprocessor">#define LOCK(m) pthread_mutex_lock((m))</span>
<a name="l00074"></a><a class="code" href="HTTPCache_8h.html#ea719fb108b1d8bb9214dc49204ad0f0">00074</a> <span class="preprocessor"></span><span class="preprocessor">#define TRYLOCK(m) pthread_mutex_trylock((m))</span>
<a name="l00075"></a><a class="code" href="HTTPCache_8h.html#f2aa2fe13863361670b63de7e6df0fdd">00075</a> <span class="preprocessor"></span><span class="preprocessor">#define UNLOCK(m) pthread_mutex_unlock((m))</span>
<a name="l00076"></a><a class="code" href="HTTPCache_8h.html#80412ba526b7b04f6784d1f992be57e9">00076</a> <span class="preprocessor"></span><span class="preprocessor">#define INIT(m) pthread_mutex_init((m), 0)</span>
<a name="l00077"></a><a class="code" href="HTTPCache_8h.html#a713a380e0f57370ec8380acf82b951c">00077</a> <span class="preprocessor"></span><span class="preprocessor">#define DESTROY(m) pthread_mutex_destroy((m))</span>
<a name="l00078"></a>00078 <span class="preprocessor"></span>
<a name="l00079"></a>00079 <span class="keyword">using namespace </span>std;
<a name="l00080"></a>00080 
<a name="l00081"></a>00081 <span class="keyword">namespace </span>libdap
<a name="l00082"></a>00082 {
<a name="l00083"></a>00083 
<a name="l00084"></a>00084 <span class="comment">// This function is exported so the test code can use it too.</span>
<a name="l00085"></a>00085 <span class="keywordtype">bool</span> <a class="code" href="namespacelibdap.html#1987f9d225c2778a297eab61a6a612b3">is_hop_by_hop_header</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;header);
<a name="l00086"></a>00086 
<a name="l00138"></a><a class="code" href="classlibdap_1_1HTTPCache.html">00138</a> <span class="keyword">class </span><a class="code" href="classlibdap_1_1HTTPCache.html">HTTPCache</a>
<a name="l00139"></a>00139 {
<a name="l00140"></a>00140 <span class="keyword">private</span>:
<a name="l00141"></a>00141     <span class="keywordtype">string</span> d_cache_root;
<a name="l00142"></a>00142     FILE *d_locked_open_file; <span class="comment">// Lock for single process use.</span>
<a name="l00143"></a>00143 
<a name="l00144"></a>00144     <span class="keywordtype">bool</span> d_cache_enabled;
<a name="l00145"></a>00145     <span class="keywordtype">bool</span> d_cache_protected;
<a name="l00146"></a>00146     <a class="code" href="namespacelibdap.html#49a7ae9e704d21900a5bebcb92ebae94">CacheDisconnectedMode</a> d_cache_disconnected;
<a name="l00147"></a>00147     <span class="keywordtype">bool</span> d_expire_ignored;
<a name="l00148"></a>00148     <span class="keywordtype">bool</span> d_always_validate;
<a name="l00149"></a>00149 
<a name="l00150"></a>00150     <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> d_total_size; <span class="comment">// How much can we store?</span>
<a name="l00151"></a>00151     <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> d_folder_size; <span class="comment">// How much of that is meta data?</span>
<a name="l00152"></a>00152     <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> d_gc_buffer; <span class="comment">// How much memory needed as buffer?</span>
<a name="l00153"></a>00153     <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> d_max_entry_size; <span class="comment">// Max individual entry size.</span>
<a name="l00154"></a>00154     <span class="keywordtype">int</span> d_default_expiration;
<a name="l00155"></a>00155 
<a name="l00156"></a>00156     vector&lt;string&gt; d_cache_control;
<a name="l00157"></a>00157     <span class="comment">// these are values read from a request-directive Cache-Control header.</span>
<a name="l00158"></a>00158     <span class="comment">// Not to be confused with values read from the response or a cached</span>
<a name="l00159"></a>00159     <span class="comment">// response (e.g., CacheEntry has a max_age field, too). These fields are</span>
<a name="l00160"></a>00160     <span class="comment">// set when the set_cache_control method is called.</span>
<a name="l00161"></a>00161     time_t d_max_age;
<a name="l00162"></a>00162     time_t d_max_stale;  <span class="comment">// -1: not set, 0:any response, &gt;0 max time.</span>
<a name="l00163"></a>00163     time_t d_min_fresh;
<a name="l00164"></a>00164 
<a name="l00165"></a>00165     <span class="comment">// Lock non-const methods (also ones that use the STL).</span>
<a name="l00166"></a>00166     pthread_mutex_t d_cache_mutex;
<a name="l00167"></a>00167     
<a name="l00168"></a>00168     <a class="code" href="classlibdap_1_1HTTPCacheTable.html">HTTPCacheTable</a> *d_http_cache_table;
<a name="l00169"></a>00169 
<a name="l00170"></a>00170     <span class="comment">// d_open_files is used by the interrupt handler to clean up</span>
<a name="l00171"></a>00171     vector&lt;string&gt; d_open_files;
<a name="l00172"></a>00172 
<a name="l00173"></a>00173     <span class="keyword">static</span> <a class="code" href="classlibdap_1_1HTTPCache.html">HTTPCache</a> *_instance;
<a name="l00174"></a>00174 
<a name="l00175"></a><a class="code" href="classlibdap_1_1HTTPCache.html#76bd6ce419aad54c8c87e993f5bd11c9">00175</a>     <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classlibdap_1_1HTTPCache.html#76bd6ce419aad54c8c87e993f5bd11c9">HTTPCacheTest</a>; <span class="comment">// Unit tests</span>
<a name="l00176"></a><a class="code" href="classlibdap_1_1HTTPCache.html#99997995a5158687260499f88ea57f36">00176</a>     <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classlibdap_1_1HTTPCacheInterruptHandler.html">HTTPCacheInterruptHandler</a>;
<a name="l00177"></a>00177 
<a name="l00178"></a>00178     <span class="comment">// Private methods</span>
<a name="l00179"></a>00179     <a class="code" href="classlibdap_1_1HTTPCache.html">HTTPCache</a>(<span class="keyword">const</span> <a class="code" href="classlibdap_1_1HTTPCache.html">HTTPCache</a> &amp;) {
<a name="l00180"></a>00180         <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1InternalErr.html" title="A class for software fault reporting.">InternalErr</a>(__FILE__, __LINE__, <span class="stringliteral">"Unimplemented"</span>);
<a name="l00181"></a>00181     }
<a name="l00182"></a>00182     <a class="code" href="classlibdap_1_1HTTPCache.html">HTTPCache</a>() {
<a name="l00183"></a>00183         <span class="keywordflow">throw</span> <a class="code" href="classlibdap_1_1InternalErr.html" title="A class for software fault reporting.">InternalErr</a>(__FILE__, __LINE__, <span class="stringliteral">"Unimplemented"</span>);
<a name="l00184"></a>00184     }
<a name="l00185"></a>00185     HTTPCache &amp;operator=(<span class="keyword">const</span> HTTPCache &amp;) {
<a name="l00186"></a>00186         <span class="keywordflow">throw</span> InternalErr(__FILE__, __LINE__, <span class="stringliteral">"Unimplemented"</span>);
<a name="l00187"></a>00187     }
<a name="l00188"></a>00188 
<a name="l00189"></a>00189     HTTPCache(<span class="keywordtype">string</span> cache_root, <span class="keywordtype">bool</span> force);
<a name="l00190"></a>00190 
<a name="l00191"></a>00191     <span class="keyword">static</span> <span class="keywordtype">void</span> delete_instance(); <span class="comment">// Run by atexit (hence static)</span>
<a name="l00192"></a>00192     
<a name="l00193"></a>00193     <span class="keywordtype">void</span> set_cache_root(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;root = <span class="stringliteral">""</span>);
<a name="l00194"></a>00194     <span class="keywordtype">void</span> create_cache_root(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;cache_root);
<a name="l00195"></a>00195     
<a name="l00196"></a>00196     <span class="comment">// These will go away when the cache can be used by multiple processes.</span>
<a name="l00197"></a>00197     <span class="keywordtype">bool</span> get_single_user_lock(<span class="keywordtype">bool</span> force = <span class="keyword">false</span>);
<a name="l00198"></a>00198     <span class="keywordtype">void</span> release_single_user_lock();
<a name="l00199"></a>00199     
<a name="l00200"></a>00200     <span class="keywordtype">bool</span> is_url_in_cache(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;url);
<a name="l00201"></a>00201 
<a name="l00202"></a>00202     <span class="comment">// I made these four methods so they could be tested by HTTPCacheTest.</span>
<a name="l00203"></a>00203     <span class="comment">// Otherwise they would be static functions. jhrg 10/01/02</span>
<a name="l00204"></a>00204     <span class="keywordtype">void</span> write_metadata(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;cachename, <span class="keyword">const</span> vector&lt;string&gt; &amp;headers);
<a name="l00205"></a>00205     <span class="keywordtype">void</span> read_metadata(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;cachename, vector&lt;string&gt; &amp;headers);
<a name="l00206"></a>00206     <span class="keywordtype">int</span> write_body(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;cachename, <span class="keyword">const</span> FILE *src);
<a name="l00207"></a>00207     FILE *open_body(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;cachename);
<a name="l00208"></a>00208 
<a name="l00209"></a>00209     <span class="keywordtype">bool</span> stopGC() <span class="keyword">const</span>;
<a name="l00210"></a>00210     <span class="keywordtype">bool</span> startGC() <span class="keyword">const</span>;
<a name="l00211"></a>00211 
<a name="l00212"></a>00212     <span class="keywordtype">void</span> perform_garbage_collection();
<a name="l00213"></a>00213     <span class="keywordtype">void</span> too_big_gc();
<a name="l00214"></a>00214     <span class="keywordtype">void</span> expired_gc();
<a name="l00215"></a>00215     <span class="keywordtype">void</span> hits_gc();
<a name="l00216"></a>00216 
<a name="l00217"></a>00217 <span class="keyword">public</span>:
<a name="l00218"></a>00218     <span class="keyword">static</span> HTTPCache *<a class="code" href="classlibdap_1_1HTTPCache.html#152bdc19fdec15758d9c1a3a029d6900">instance</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;cache_root, <span class="keywordtype">bool</span> force = <span class="keyword">false</span>);
<a name="l00219"></a>00219     <span class="keyword">virtual</span> <a class="code" href="classlibdap_1_1HTTPCache.html#c8fcde4b345c50bad6c3507dcbd2f447">~HTTPCache</a>();
<a name="l00220"></a>00220 
<a name="l00221"></a>00221     <span class="keywordtype">string</span> <a class="code" href="classlibdap_1_1HTTPCache.html#7cbd2f101aa03496fa7b7a3223327729">get_cache_root</a>() <span class="keyword">const</span>;
<a name="l00222"></a>00222 
<a name="l00223"></a>00223     <span class="keywordtype">void</span> <a class="code" href="classlibdap_1_1HTTPCache.html#71aa835c2b38bc0e891f40b5a77c53ce">set_cache_enabled</a>(<span class="keywordtype">bool</span> mode);
<a name="l00224"></a>00224     <span class="keywordtype">bool</span> <a class="code" href="classlibdap_1_1HTTPCache.html#4492276bc732605cef02a146a657811f">is_cache_enabled</a>() <span class="keyword">const</span>;
<a name="l00225"></a>00225 
<a name="l00226"></a>00226     <span class="keywordtype">void</span> <a class="code" href="classlibdap_1_1HTTPCache.html#44857ae03334d09e34cc5b2275669a71">set_cache_disconnected</a>(<a class="code" href="namespacelibdap.html#49a7ae9e704d21900a5bebcb92ebae94">CacheDisconnectedMode</a> mode);
<a name="l00227"></a>00227     <a class="code" href="namespacelibdap.html#49a7ae9e704d21900a5bebcb92ebae94">CacheDisconnectedMode</a> <a class="code" href="classlibdap_1_1HTTPCache.html#857226db32577ea790fe2a283d751ce8">get_cache_disconnected</a>() <span class="keyword">const</span>;
<a name="l00228"></a>00228 
<a name="l00229"></a>00229     <span class="keywordtype">void</span> <a class="code" href="classlibdap_1_1HTTPCache.html#1a8c5f13e82c3038e97eca9979ebd39c">set_expire_ignored</a>(<span class="keywordtype">bool</span> mode);
<a name="l00230"></a>00230     <span class="keywordtype">bool</span> <a class="code" href="classlibdap_1_1HTTPCache.html#0832a441ed8e037653d4e57b5f85813f">is_expire_ignored</a>() <span class="keyword">const</span>;
<a name="l00231"></a>00231 
<a name="l00232"></a>00232     <span class="keywordtype">void</span> <a class="code" href="classlibdap_1_1HTTPCache.html#b2447c27c88ebb29511379ede8ac5b6f">set_max_size</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> size);
<a name="l00233"></a>00233     <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classlibdap_1_1HTTPCache.html#82e0235b7df1edbdb284b4f790d83cca">get_max_size</a>() <span class="keyword">const</span>;
<a name="l00234"></a>00234 
<a name="l00235"></a>00235     <span class="keywordtype">void</span> <a class="code" href="classlibdap_1_1HTTPCache.html#92cc5b035dc08ae2704924002144fa29">set_max_entry_size</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> size);
<a name="l00236"></a>00236     <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classlibdap_1_1HTTPCache.html#1adefd265732d5cd60d0a2a44bfd54a0">get_max_entry_size</a>() <span class="keyword">const</span>;
<a name="l00237"></a>00237 
<a name="l00238"></a>00238     <span class="keywordtype">void</span> <a class="code" href="classlibdap_1_1HTTPCache.html#1ca5c8c205241f62596e283943906386">set_default_expiration</a>(<span class="keywordtype">int</span> exp_time);
<a name="l00239"></a>00239     <span class="keywordtype">int</span> <a class="code" href="classlibdap_1_1HTTPCache.html#391c78fac4f21bae526d363cd6f66ee7">get_default_expiration</a>() <span class="keyword">const</span>;
<a name="l00240"></a>00240 
<a name="l00241"></a>00241     <span class="keywordtype">void</span> <a class="code" href="classlibdap_1_1HTTPCache.html#a9a13a18ec837e891e81823a4d30da47">set_always_validate</a>(<span class="keywordtype">bool</span> validate);
<a name="l00242"></a>00242     <span class="keywordtype">bool</span> <a class="code" href="classlibdap_1_1HTTPCache.html#c0cb038b8b7aa0680b2058267e285e41">get_always_validate</a>() <span class="keyword">const</span>;
<a name="l00243"></a>00243 
<a name="l00244"></a>00244     <span class="keywordtype">void</span> <a class="code" href="classlibdap_1_1HTTPCache.html#c6823b2de27745c20c7e8d41af5a2088">set_cache_control</a>(<span class="keyword">const</span> vector&lt;string&gt; &amp;cc);
<a name="l00245"></a>00245     vector&lt;string&gt; <a class="code" href="classlibdap_1_1HTTPCache.html#15d15a90105d60b0d743fc90456d223e">get_cache_control</a>();
<a name="l00246"></a>00246 
<a name="l00247"></a><a class="code" href="classlibdap_1_1HTTPCache.html#71ed87540113c4403a33bb436d3f8b9c">00247</a>     <span class="keywordtype">void</span> <a class="code" href="classlibdap_1_1HTTPCache.html#71ed87540113c4403a33bb436d3f8b9c">lock_cache_interface</a>() {
<a name="l00248"></a>00248         <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">"Locking interface... "</span>);
<a name="l00249"></a>00249         <a class="code" href="HTTPCache_8h.html#16e4e2643dc8f8b07b8be8bebd189ad5">LOCK</a>(&amp;d_cache_mutex);
<a name="l00250"></a>00250         <a class="code" href="debug_8h.html#0d28d57d1228cf13a4c1288cc4758344">DBGN</a>(cerr &lt;&lt; <span class="stringliteral">"Done"</span> &lt;&lt; endl);
<a name="l00251"></a>00251     }           
<a name="l00252"></a><a class="code" href="classlibdap_1_1HTTPCache.html#5b6a28e17912e87389260f7695fdf876">00252</a>     <span class="keywordtype">void</span> <a class="code" href="classlibdap_1_1HTTPCache.html#5b6a28e17912e87389260f7695fdf876">unlock_cache_interface</a>() {
<a name="l00253"></a>00253         <a class="code" href="debug_8h.html#32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">"Unlocking interface... "</span> );
<a name="l00254"></a>00254         <a class="code" href="HTTPCache_8h.html#f2aa2fe13863361670b63de7e6df0fdd">UNLOCK</a>(&amp;d_cache_mutex);
<a name="l00255"></a>00255         <a class="code" href="debug_8h.html#0d28d57d1228cf13a4c1288cc4758344">DBGN</a>(cerr &lt;&lt; <span class="stringliteral">"Done"</span> &lt;&lt; endl);
<a name="l00256"></a>00256     }
<a name="l00257"></a>00257     
<a name="l00258"></a>00258     <span class="comment">// This must lock for writing</span>
<a name="l00259"></a>00259     <span class="keywordtype">bool</span> <a class="code" href="classlibdap_1_1HTTPCache.html#0cbaded239e55f3e328448adcc180365">cache_response</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;url, time_t request_time,
<a name="l00260"></a>00260                         <span class="keyword">const</span> vector&lt;string&gt; &amp;headers, <span class="keyword">const</span> FILE *body);
<a name="l00261"></a>00261     <span class="keywordtype">void</span> <a class="code" href="classlibdap_1_1HTTPCache.html#b0b1e3fb63084b93e277c53d189ad6c2">update_response</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;url, time_t request_time,
<a name="l00262"></a>00262                          <span class="keyword">const</span> vector&lt;string&gt; &amp;headers);
<a name="l00263"></a>00263 
<a name="l00264"></a>00264     <span class="comment">// This is separate from get_cached_response() because often an invalid</span>
<a name="l00265"></a>00265     <span class="comment">// cache entry just needs a header update. That is best left to the HTTP</span>
<a name="l00266"></a>00266     <span class="comment">// Connection code.</span>
<a name="l00267"></a>00267     <span class="keywordtype">bool</span> <a class="code" href="classlibdap_1_1HTTPCache.html#a695d43815cc2588458232f37095b780">is_url_valid</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;url);
<a name="l00268"></a>00268     
<a name="l00269"></a>00269     <span class="comment">// Lock these for reading</span>
<a name="l00270"></a>00270     vector&lt;string&gt; <a class="code" href="classlibdap_1_1HTTPCache.html#635a277480a95d7d37d0e9fddd480362">get_conditional_request_headers</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;url);
<a name="l00271"></a>00271     FILE *<a class="code" href="classlibdap_1_1HTTPCache.html#efcbe732444c6160c839b9e2c3468b1d">get_cached_response</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;url, vector&lt;string&gt; &amp;headers,
<a name="l00272"></a>00272                                                   <span class="keywordtype">string</span> &amp;cacheName);
<a name="l00273"></a>00273     FILE *<a class="code" href="classlibdap_1_1HTTPCache.html#efcbe732444c6160c839b9e2c3468b1d">get_cached_response</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;url, vector&lt;string&gt; &amp;headers);
<a name="l00274"></a>00274     FILE *<a class="code" href="classlibdap_1_1HTTPCache.html#efcbe732444c6160c839b9e2c3468b1d">get_cached_response</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;url);
<a name="l00275"></a>00275 
<a name="l00276"></a>00276     <span class="keywordtype">void</span> <a class="code" href="classlibdap_1_1HTTPCache.html#4de0458e4ab0e89049a0f0fa7b819b91">release_cached_response</a>(FILE *response);
<a name="l00277"></a>00277 
<a name="l00278"></a>00278     <span class="keywordtype">void</span> <a class="code" href="classlibdap_1_1HTTPCache.html#fee7fca59d1a37f495ea74c95fad600a">purge_cache</a>();
<a name="l00279"></a>00279 };
<a name="l00280"></a>00280 
<a name="l00281"></a>00281 } <span class="comment">// namespace libdap</span>
<a name="l00282"></a>00282 
<a name="l00283"></a>00283 <span class="preprocessor">#endif // _http_cache_h</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Wed Oct 7 19:57:07 2009 for libdap++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address>
</body>
</html>