1
/*------------------------------------------------------------------------------
2
* Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
4
* Distributable under the terms of either the Apache License (Version 2.0) or
5
* the GNU Lesser General Public License, as specified in the COPYING file.
6
------------------------------------------------------------------------------*/
7
#ifndef _lucene_search_FilterResultCache_
8
#define _lucene_search_FilterResultCache_
10
CL_CLASS_DEF(index,IndexReader)
15
* Holds one cached result
18
class ResultHolder : LUCENE_BASE
24
ResultHolder( T * result, bool deleteRes )
26
this->result = result;
27
this->deleteRes = deleteRes;
36
* Wraps another filter's result and caches it. The purpose is to allow
37
* filters to implement this and allow itself to be cached. Alternatively,
38
* use the CachingWrapperFilter to cache the filter.
41
class FilterResultCache
43
typedef CL_NS(util)::CLHashMap<
44
CL_NS(index)::IndexReader*,
46
CL_NS(util)::Compare::Void<CL_NS(index)::IndexReader>,
47
CL_NS(util)::Equals::Void<CL_NS(index)::IndexReader>,
48
CL_NS(util)::Deletor::Object<CL_NS(index)::IndexReader>,
49
CL_NS(util)::Deletor::Object<ResultHolder<T> >
54
DEFINE_MUTEX( cache_LOCK )
58
FilterResultCache( bool bDeleteResults );
59
virtual ~FilterResultCache();
61
T* getResult( CL_NS(index)::IndexReader* reader );
64
void closeCallback( CL_NS(index)::IndexReader* reader, void* param );