ThinkGeo.com    |     Blog    |     Wiki    |     Support

GeoCache in FeatureSource of sqllayer

Hi,

I have few questions about Geocache.

There is a notion of GeoCache on the featuresource for a sqllayer.
I imagine that this notion makes it possible to cache the polygons each time the layer is called.
If the sqllayer is updated, (addition of a polygon in the layer) is the GeoCache updated automatically or must it be renewed ?
Is it better to activate the geocache only for layers that are not updated?
Does activating the geocache improve performance?
Is it possible to see what is in the geocache? How is the geocache organized?

Thanks.
Regards.

Steph.

Hi Steph,

Thanks a lot for your questions, including some pretty good suggestions. Please check my comments below:

Question: If the sqllayer is updated, (addition of a polygon in the layer) is the GeoCache updated automatically or must it be renewed ?
Answer : it must be renewed, the GeoCache is only a memory cache based on boundingbox. In other words, the GeoCache hosts a Quadtree to cache a collection of features in a specific boundingbox. It cannot update itself when a cache feature is updates in FeatureSource or FeatureLayer. It has no idea on what FeatureLayer or FeatureSource it belongs to.

Question: Is it better to activate the geocache only for layers that are not updated?
Answer : Yes, better that oly activate the GeoCache only for static layers.

Question: Does activating the geocache improve performance?
Answer : Depends, if we are using the InMemoryFeatureLayer or InMemoryFeatureSource, I guess it cannot imporve the performance, because still very fast to query features from memory. However, for others, such as ShapeFileFeatureSource, MsSqlFeatureSource and more, the answer is “Yes”, it will check if the features in queried extent has been cached in local memory, if yes, it will read from local memory directly, thus avoiding the time on IO, the performance is improved. the only disadvantage is the local memory is consumed.

Question: Is it possible to see what is in the geocache? How is the geocache organized?
Answer : In GeoCache class, there are 3 local variables to host the features, one Quadtree is for “FeatureId” and its “BoundingBox”, one Collection for the all cached boundingbox. one Dictionary<string, Feature> for the “Feature Id” and its value.

Regards,
Johnny

Hi,

Thanks Johnny.
Regards.
Steph.