[Geoserver-devel] Cache clearing in GeoServer

Hi,
as most of you may know GeoServer caches configuration objects (but not data) and we have a button in the status page to clear those caches.

Very nice. However, the rendering subsystem also caches the external images, since they can be quite heavy to load.
I've just added some cache clearing methods to GeoToools (waiting for a better time to actually add resource up-to-dateness tests over various
protocols) and I would like to wire them with the "clean resource cache" button.

However, there is a catch: web-core does not (and should not) know
about the renderer (which is WMS specific), so I cannot call those
new methods there.

Where should I do that then? I cannot find a good existing spot, but
I have two ideas.

Cheap one
-----------------------------

Cache clearing involves calling into ResourcePool.dispose(), which
will dispose of all caches. That will result, as a side effect, in
calls to ResourcePool.Listener for each disposed store, coverage and
feature type.
So I was thinking, let's add a new method to that Listener,
simply "void disposed()", which is called when the ResourcePool.dispose() method is called.

In the WMS module we can then add a listener that will look for that
and clear the rendering caches as well.

Big architecture one
------------------------------

The little architecture astronaut in me also considers the idea of
having a CacheDisposer interface that can be implemented in various
modules, and a central utility (CacheDisposers?) that looks up for all those disposers, and then we wire up rest config and the GUI to that method.

Any other idea?

That eternal image cache has beaten me one too many times, I really
want to see it go :wink:

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

I sort of like the first approach clean an d simple. Although I am not against the second if it seems necessary to roll out and entire interface for it.

2c

-Justin

On May 7, 2010, at 11:25 AM, Andrea Aime <aaime@anonymised.com> wrote:

Hi,
as most of you may know GeoServer caches configuration objects (but not
data) and we have a button in the status page to clear those caches.

Very nice. However, the rendering subsystem also caches the external
images, since they can be quite heavy to load.
I've just added some cache clearing methods to GeoToools (waiting for a
better time to actually add resource up-to-dateness tests over various
protocols) and I would like to wire them with the "clean resource cache"
button.

However, there is a catch: web-core does not (and should not) know
about the renderer (which is WMS specific), so I cannot call those
new methods there.

Where should I do that then? I cannot find a good existing spot, but
I have two ideas.

Cheap one
-----------------------------

Cache clearing involves calling into ResourcePool.dispose(), which
will dispose of all caches. That will result, as a side effect, in
calls to ResourcePool.Listener for each disposed store, coverage and
feature type.
So I was thinking, let's add a new method to that Listener,
simply "void disposed()", which is called when the
ResourcePool.dispose() method is called.

In the WMS module we can then add a listener that will look for that
and clear the rendering caches as well.

Big architecture one
------------------------------

The little architecture astronaut in me also considers the idea of
having a CacheDisposer interface that can be implemented in various
modules, and a central utility (CacheDisposers?) that looks up for all
those disposers, and then we wire up rest config and the GUI to that method.

Any other idea?

That eternal image cache has beaten me one too many times, I really
want to see it go :wink:

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------

_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel