QgsAbstractCacheIndex class

Abstract base class for cache indices.

Constructors, destructors, conversion operators

QgsAbstractCacheIndex() defaulted
Constructor for QgsAbstractCacheIndex.

Public functions

void flush() pure virtual
Sometimes, the whole cache changes its state and its easier to just withdraw everything.
void flushFeature(QgsFeatureId fid) pure virtual
Is called, whenever a feature is removed from the cache.
auto getCacheIterator(QgsFeatureIterator& featureIterator, const QgsFeatureRequest& featureRequest) -> bool pure virtual
Is called, when a feature request is issued on a cached layer.
void requestCompleted(const QgsFeatureRequest& featureRequest, const QgsFeatureIds& fids) virtual
Implement this method to update the the indices, in case you need information contained by the request to properly index.

Function documentation

void QgsAbstractCacheIndex::flush() pure virtual

Sometimes, the whole cache changes its state and its easier to just withdraw everything.

In this case, this method is issued. Be sure to clear all cache information in here.

void QgsAbstractCacheIndex::flushFeature(QgsFeatureId fid) pure virtual

Is called, whenever a feature is removed from the cache.

You should update your indexes, so they become invalid in case this feature was required to successfully answer a request.

bool QgsAbstractCacheIndex::getCacheIterator(QgsFeatureIterator& featureIterator, const QgsFeatureRequest& featureRequest) pure virtual

Is called, when a feature request is issued on a cached layer.

Parameters
featureIterator A reference to a QgsFeatureIterator. A valid featureIterator will be assigned in case this index is able to answer the request and the return value is true.
featureRequest The feature request, for which this index is queried.
Returns True, if this index holds the information to answer the request.

If this cache index is able to completely answer the feature request, it will return true and set the iterator to a valid iterator over the cached features. If it is not able it will return false.

void QgsAbstractCacheIndex::requestCompleted(const QgsFeatureRequest& featureRequest, const QgsFeatureIds& fids) virtual

Implement this method to update the the indices, in case you need information contained by the request to properly index.

Parameters
featureRequest The feature request that was answered
fids The feature ids that have been returned

(E.g. spatial index) Does nothing by default