Sophie

Sophie

distrib > Fedora > 16 > i386 > by-pkgid > c9cfbd1355daacaf3b34517a6d7b18cc > files > 218

libdap-doc-3.11.0-2.fc15.i686.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>libdap++: HTTPCache.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.3 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">libdap++&#160;<span id="projectnumber">Updated for version 3.8.2</span></div>
  </td>
 </tr>
 </tbody>
</table>
</div>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;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 id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('HTTPCache_8h.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<h1>HTTPCache.h</h1>  </div>
</div>
<div class="contents">
<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 &quot;<a class="code" href="HTTPCacheTable_8h.html">HTTPCacheTable.h</a>&quot;</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 &quot;<a class="code" href="Error_8h.html">Error.h</a>&quot;</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 &quot;<a class="code" href="InternalErr_8h.html">InternalErr.h</a>&quot;</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 &quot;<a class="code" href="debug_8h.html">debug.h</a>&quot;</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&#39;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 &quot;<a class="code" href="ResponseTooBigErr_8h.html">ResponseTooBigErr.h</a>&quot;</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 &quot;<a class="code" href="HTTPCacheDisconnectedMode_8h.html">HTTPCacheDisconnectedMode.h</a>&quot;</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 &quot;<a class="code" href="SignalHandlerRegisteredErr_8h.html">SignalHandlerRegisteredErr.h</a>&quot;</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#a16e4e2643dc8f8b07b8be8bebd189ad5">00073</a> <span class="preprocessor">#define LOCK(m) pthread_mutex_lock((m))</span>
<a name="l00074"></a><a class="code" href="HTTPCache_8h.html#aea719fb108b1d8bb9214dc49204ad0f0">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#af2aa2fe13863361670b63de7e6df0fdd">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#a80412ba526b7b04f6784d1f992be57e9">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#aa713a380e0f57370ec8380acf82b951c">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#a1987f9d225c2778a297eab61a6a612b3">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#a49a7ae9e704d21900a5bebcb92ebae94">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#a76bd6ce419aad54c8c87e993f5bd11c9">00175</a>     <span class="keyword">friend</span> <span class="keyword">class </span>HTTPCacheTest; <span class="comment">// Unit tests</span>
<a name="l00176"></a><a class="code" href="classlibdap_1_1HTTPCache.html#a99997995a5158687260499f88ea57f36">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">&quot;Unimplemented&quot;</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">&quot;Unimplemented&quot;</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">&quot;Unimplemented&quot;</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">&quot;&quot;</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 *instance(<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> ~HTTPCache();
<a name="l00220"></a>00220 
<a name="l00221"></a>00221     <span class="keywordtype">string</span> get_cache_root() <span class="keyword">const</span>;
<a name="l00222"></a>00222 
<a name="l00223"></a>00223     <span class="keywordtype">void</span> set_cache_enabled(<span class="keywordtype">bool</span> mode);
<a name="l00224"></a>00224     <span class="keywordtype">bool</span> is_cache_enabled() <span class="keyword">const</span>;
<a name="l00225"></a>00225 
<a name="l00226"></a>00226     <span class="keywordtype">void</span> set_cache_disconnected(<a class="code" href="namespacelibdap.html#a49a7ae9e704d21900a5bebcb92ebae94">CacheDisconnectedMode</a> mode);
<a name="l00227"></a>00227     <a class="code" href="namespacelibdap.html#a49a7ae9e704d21900a5bebcb92ebae94">CacheDisconnectedMode</a> get_cache_disconnected() <span class="keyword">const</span>;
<a name="l00228"></a>00228 
<a name="l00229"></a>00229     <span class="keywordtype">void</span> set_expire_ignored(<span class="keywordtype">bool</span> mode);
<a name="l00230"></a>00230     <span class="keywordtype">bool</span> is_expire_ignored() <span class="keyword">const</span>;
<a name="l00231"></a>00231 
<a name="l00232"></a>00232     <span class="keywordtype">void</span> set_max_size(<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> get_max_size() <span class="keyword">const</span>;
<a name="l00234"></a>00234 
<a name="l00235"></a>00235     <span class="keywordtype">void</span> set_max_entry_size(<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> get_max_entry_size() <span class="keyword">const</span>;
<a name="l00237"></a>00237 
<a name="l00238"></a>00238     <span class="keywordtype">void</span> set_default_expiration(<span class="keywordtype">int</span> exp_time);
<a name="l00239"></a>00239     <span class="keywordtype">int</span> get_default_expiration() <span class="keyword">const</span>;
<a name="l00240"></a>00240 
<a name="l00241"></a>00241     <span class="keywordtype">void</span> set_always_validate(<span class="keywordtype">bool</span> validate);
<a name="l00242"></a>00242     <span class="keywordtype">bool</span> get_always_validate() <span class="keyword">const</span>;
<a name="l00243"></a>00243 
<a name="l00244"></a>00244     <span class="keywordtype">void</span> set_cache_control(<span class="keyword">const</span> vector&lt;string&gt; &amp;cc);
<a name="l00245"></a>00245     vector&lt;string&gt; get_cache_control();
<a name="l00246"></a>00246 
<a name="l00247"></a><a class="code" href="classlibdap_1_1HTTPCache.html#a71ed87540113c4403a33bb436d3f8b9c">00247</a>     <span class="keywordtype">void</span> <a class="code" href="classlibdap_1_1HTTPCache.html#a71ed87540113c4403a33bb436d3f8b9c">lock_cache_interface</a>() {
<a name="l00248"></a>00248         <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Locking interface... &quot;</span>);
<a name="l00249"></a>00249         <a class="code" href="HTTPCache_8h.html#a16e4e2643dc8f8b07b8be8bebd189ad5">LOCK</a>(&amp;d_cache_mutex);
<a name="l00250"></a>00250         <a class="code" href="debug_8h.html#a0d28d57d1228cf13a4c1288cc4758344">DBGN</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Done&quot;</span> &lt;&lt; endl);
<a name="l00251"></a>00251     }           
<a name="l00252"></a><a class="code" href="classlibdap_1_1HTTPCache.html#a5b6a28e17912e87389260f7695fdf876">00252</a>     <span class="keywordtype">void</span> <a class="code" href="classlibdap_1_1HTTPCache.html#a5b6a28e17912e87389260f7695fdf876">unlock_cache_interface</a>() {
<a name="l00253"></a>00253         <a class="code" href="debug_8h.html#a32adf79142f0a426b5e782fb7cd4cad3">DBG</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Unlocking interface... &quot;</span> );
<a name="l00254"></a>00254         <a class="code" href="HTTPCache_8h.html#af2aa2fe13863361670b63de7e6df0fdd">UNLOCK</a>(&amp;d_cache_mutex);
<a name="l00255"></a>00255         <a class="code" href="debug_8h.html#a0d28d57d1228cf13a4c1288cc4758344">DBGN</a>(cerr &lt;&lt; <span class="stringliteral">&quot;Done&quot;</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> cache_response(<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> update_response(<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> is_url_valid(<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; get_conditional_request_headers(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;url);
<a name="l00271"></a>00271     FILE *get_cached_response(<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 *get_cached_response(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;url, vector&lt;string&gt; &amp;headers);
<a name="l00274"></a>00274     FILE *get_cached_response(<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> release_cached_response(FILE *response);
<a name="l00277"></a>00277 
<a name="l00278"></a>00278     <span class="keywordtype">void</span> purge_cache();
<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>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="HTTPCache_8h.html">HTTPCache.h</a>      </li>
      <li class="footer">Generated on Tue Feb 8 2011 for libdap++ by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </li>
    </ul>
  </div>

</body>
</html>