+
+int configcache::readFullBlock(char *tmpData, long unsigned int dataSize)
+{
+ /* try to read header */
+ if ( openFileDesc.extended )
+ if ( ! readAllHeaders() )
+ return -1;
+
+ /* read data */
+ return readDataToMem(tmpData, dataSize);
+}
+
+int configcache::readDataToMem(char *tmpData, long unsigned int dataSize)
+{
+ int readturn = -1;
+
+ if ( dataSize == 0 ) return 0;
+
+ try { readturn = boost::iostreams::read(*inBuffer, tmpData, dataSize); }
+ catch(boost::iostreams::bzip2_error& error) {
+ if(log) *log << "CCACHE: Caught bzip2 exception with error code: " << error.error() << endl << flush;
+ inFile.close();
+ }
+ catch (std::exception const& ex) {
+ if(log) *log << "CCACHE: Caught exception: " << ex.what() << endl << flush;
+ inFile.close();
+ }
+ catch( ... ) {
+ if(log) *log << "CCACHE: Caught unknown exception while reading." << endl << flush;
+ inFile.close();
+ }
+
+ return readturn;
+}
+
+unsigned long configcache::hash(const string& str)
+{
+ unsigned long hash = 5381;
+
+ for(string::const_iterator it=str.begin();it!=str.end();it++)
+ hash = ((hash << 5) + hash) + *it; /* hash * 33 + character */
+
+ return hash;
+}
+
+void configcache::deleteHeaderStore()
+{
+ while ( headerStore.size() > 0 ) {
+ free(headerStore.back().second);
+ headerStore.pop_back();
+ }
+}