[Geoserver-users] How to delete tile layer cache if layer data is updated?

Hi

I am just wondering if there is a way to programmatically delete a tile layer’s cache if the data from the layer is updated?

Currently looking at trying to create a script that will just delete the cache from a scheduled task so I can make sure that the data is as current as possible (within the last day) when users are accessing the web application with the data on, but it would be even better if I can make it completely current.

Thanks, Chris

On Tue, Apr 19, 2016 at 10:02 AM, Chris Buckmaster <
chris.buckmaster@anonymised.com> wrote:

Hi

I am just wondering if there is a way to programmatically delete a tile
layer’s cache if the data from the layer is updated?

GWC exposes a REST api with a truncate call that you can use to delete
selected areas and zoom levels (or just everything if you want).
See the documentation:
http://docs.geoserver.org/2.8.x/en/user/geowebcache/rest/index.html

Currently looking at trying to create a script that will just delete the
cache from a scheduled task so I can make sure that the data is as current
as possible (within the last day) when users are accessing the web
application with the data on, but it would be even better if I can make it
completely current.

Just call trucante when your data changes? The main issue is, how will
GeoServer get to know your
data changed? No data source normally provides this information as an
"event".
If you have a database, maybe you can setup triggers that can call the GWC
rest api for you.

Or, if you modify the data via WFS-T though GeoServer, then it will be
fully automatic (there is
an event that WFS sends to GWC to make it drop tiles)

Hope this helps

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

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

Thanks for the reply Andrea, someone also mentioned that because the cache is stored as flat files, I could just write a scheduled task to delete these files on the server? (this wouldn’t obviously work for the scenario I asked, but I think I would be fine with just deleting the cache each night).

Chris

···

On Tue, Apr 19, 2016 at 10:02 AM, Chris Buckmaster <chris.buckmaster@…7473…> wrote:

Hi

I am just wondering if there is a way to programmatically delete a tile layer’s cache if the data from the layer is updated?

GWC exposes a REST api with a truncate call that you can use to delete selected areas and zoom levels (or just everything if you want).

See the documentation: http://docs.geoserver.org/2.8.x/en/user/geowebcache/rest/index.html

Currently looking at trying to create a script that will just delete the cache from a scheduled task so I can make sure that the data is as current as possible (within the last day) when users are accessing the web application with the data on, but it would be even better if I can make it completely current.

Just call trucante when your data changes? The main issue is, how will GeoServer get to know your

data changed? No data source normally provides this information as an “event”.

If you have a database, maybe you can setup triggers that can call the GWC rest api for you.

Or, if you modify the data via WFS-T though GeoServer, then it will be fully automatic (there is

an event that WFS sends to GWC to make it drop tiles)

Hope this helps

Cheers

Andrea

==

GeoServer Professional Services from the experts! Visit

http://goo.gl/it488V for more information.

==

Ing. Andrea Aime

@geowolf

Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)

phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 339 8844549

http://www.geo-solutions.it

http://twitter.com/geosolutions_it

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.


On Thu, Apr 21, 2016 at 9:29 AM, Chris Buckmaster <
chris.buckmaster@anonymised.com> wrote:

Thanks for the reply Andrea, someone also mentioned that because the cache
is stored as flat files, I could just write a scheduled task to delete
these files on the server? (this wouldn’t obviously work for the scenario I
asked, but I think I would be fine with just deleting the cache each night).

I would only if you are not using a disk quota mechanism, if it is, you'd
be deleting the files on the quota
mechanism's back, and there would be probably no recovery for its disk
usage accounting at that point

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

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

Ok thanks Andrea

Chris

···

On Thu, Apr 21, 2016 at 9:29 AM, Chris Buckmaster <chris.buckmaster@…7473…> wrote:

Thanks for the reply Andrea, someone also mentioned that because the cache is stored as flat files, I could just write a scheduled task to delete these files on the server? (this wouldn’t obviously work for the scenario I asked, but I think I would be fine with just deleting the cache each night).

I would only if you are not using a disk quota mechanism, if it is, you’d be deleting the files on the quota

mechanism’s back, and there would be probably no recovery for its disk usage accounting at that point

Cheers

Andrea

==

GeoServer Professional Services from the experts! Visit

http://goo.gl/it488V for more information.

==

Ing. Andrea Aime

@geowolf

Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)

phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 339 8844549

http://www.geo-solutions.it

http://twitter.com/geosolutions_it

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.