On Tue, Aug 9, 2011 at 9:39 PM, Chris Hodgson <span dir="ltr"><<a href="mailto:chodgson@refractions.net">chodgson@refractions.net</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
- 1-D r-tree indexes of lwgeoms<br>
- prepared geoms aka. geos geoms<br>
- Proj contexts<br>
<br>
- looking at the proj4 cache code, it appears that it would also overwrite/be overwritten by the prepared geom and r-tree index caches (all appear to use fcinfo->flinfo->fn_extra as if no-one else was using it)<br>

</blockquote><div><br>Thinking into email, it appears the requirement for the thing stored in fcinfo->flinfo->fn_extra would be an implementation of :<br><br>(crudely represented)<br>struct cache_master { <br>   cache *r_tree; <br>
   cache *prepped_geoms;<br>   cache *projections;<br>} ;<br><br>Meaning: there are three caches and you select the one you want before using it. I think the caching API would have to explicitly declare the legitimate data types (or enum {} them or something).<br>
<br>If all three caches can be forced to use integer keys, we may be able to steal this: <a href="http://elliottback.com/wp/hashmap-implementation-in-c/">http://elliottback.com/wp/hashmap-implementation-in-c/</a> Better yet, we could just use the projection cache API, since it already has an int key. However, it looks like the first two use LWGEOM structures as a key. Bah.<br>
<br>What about putting this in fn_extra:<br><br>struct uber_cache_monster { <br>   RTREE_POLY_CACHE *r_tree ; <br>   RTREE_POLY_CACHE *prepped_geoms ; <br>   PROJ4PortalCache *projections ;<br>} ; <br><br>It doesn't solve the duplicate code issue, but it should fix #547. Which, now that I look at it, is exactly what you suggested in the ticket. (<a href="http://trac.osgeo.org/postgis/ticket/547#comment:4">http://trac.osgeo.org/postgis/ticket/547#comment:4</a>) Nevermind me, I'm just catching up. <br>
<br>BTW: is fn_extra private to postgis, or is it shared among other extensions (which may also want to use it)? <br><br>Bryce<br></div></div>