* Copyright (c) 1998-2003, Index Data.
* See the file LICENSE for details.
*
- * $Id: proxy.h,v 1.11 2003-10-08 08:15:01 adam Exp $
+ * $Id: proxy.h,v 1.12 2003-10-08 08:53:08 adam Exp $
*/
#include <yaz++/z-assoc.h>
void copy_searchRequest(Z_SearchRequest *sr);
void copy_presentRequest(Z_PresentRequest *pr);
+ void set_max_size(int sz);
private:
NMEM m_mem;
Yaz_RecordCache_Entry *m_entries;
int match (Yaz_RecordCache_Entry *entry,
Odr_oid *syntax, int offset,
Z_RecordComposition *comp);
+ int m_max_size;
};
class YAZ_EXPORT Yaz_bw {
* Copyright (c) 2002-2003, Index Data.
* See the file LICENSE for details.
*
- * $Id: yaz-z-cache.cpp,v 1.5 2003-10-01 13:13:51 adam Exp $
+ * $Id: yaz-z-cache.cpp,v 1.6 2003-10-08 08:52:59 adam Exp $
*/
#include <yaz/log.h>
m_entries = 0;
m_presentRequest = 0;
m_searchRequest = 0;
+ m_max_size = 200000;
}
Yaz_RecordCache::~Yaz_RecordCache ()
nmem_destroy(m_mem);
}
+void Yaz_RecordCache::set_max_size(int sz)
+{
+ m_max_size = sz;
+}
+
void Yaz_RecordCache::clear ()
{
nmem_destroy(m_mem);
void Yaz_RecordCache::add (ODR o, Z_NamePlusRecordList *npr, int start,
int hits)
{
+ if (nmem_total(m_mem) > m_max_size)
+ return;
// Build appropriate compspec for this response
Z_RecordComposition *comp = 0;
if (hits == -1 && m_presentRequest)