From 3225d12fb64a3a18d7db43ab43a1d2b4327c48b9 Mon Sep 17 00:00:00 2001
From: David Hoese <david.hoese@ssec.wisc.edu>
Date: Mon, 20 Apr 2020 11:13:30 -0500
Subject: [PATCH] Upgrade mapcache to 1.10 and turn off debug compiler flag

---
 mapcache/Dockerfile            | 4 ++--
 mapcache/mapcache_template.xml | 2 ++
 mapcache/render.py             | 8 ++++++--
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/mapcache/Dockerfile b/mapcache/Dockerfile
index 834ff10..05adbcd 100644
--- a/mapcache/Dockerfile
+++ b/mapcache/Dockerfile
@@ -54,9 +54,9 @@ RUN mkdir -p /build_deps && cd /build_deps \
   && apt-get install -y zlib1g-dev libpng-dev libjpeg-turbo8 libfreetype6 libfribidi-dev libharfbuzz-dev libcairo2-dev libfcgi-dev libgeos++-dev postgresql postgis libxml2-dev libgif-dev libjpeg-turbo8-dev libprotobuf-dev protobuf-compiler libprotobuf-c-dev libprotobuf-c1 libprotobuf-dev protobuf-c-compiler \
   && apt-get -y clean \
   && git clone https://github.com/mapserver/mapcache.git && cd mapcache \
-  && git checkout fa73ef28ae5d56ae817e0f0ee47aaed04b8d67f3 \
+  && git checkout c467a3bb444cab69c52bc78b91b9bae3a9415f2f \
   && mkdir -p build && cd build \
-  && cmake .. -DWITH_MEMCACHE=1 -DCMAKE_BUILD_TYPE="Debug" \
+  && cmake .. \  # -DWITH_MEMCACHE=1 -DCMAKE_BUILD_TYPE="Debug" \
   && make -j$(nproc) \
   && make install
 
diff --git a/mapcache/mapcache_template.xml b/mapcache/mapcache_template.xml
index 19efcfb..e73c0a8 100644
--- a/mapcache/mapcache_template.xml
+++ b/mapcache/mapcache_template.xml
@@ -294,7 +294,9 @@
             </keywords>
         </metadata>
         <format>png_basic</format>
+        {% if basemap_autoexpire != 0 %}
         <auto_expire>{{ basemap_autoexpire }}</auto_expire>
+        {% endif %}
     </tileset>
     <tileset name="{{ plat }}_abi_graticules">
         <source>{{ plat }}_abi_graticules</source>
diff --git a/mapcache/render.py b/mapcache/render.py
index fd1fc11..4cb5b67 100644
--- a/mapcache/render.py
+++ b/mapcache/render.py
@@ -18,8 +18,12 @@ products = ["C{:02d}".format(x) for x in range(1, 17)] + ["true_color"]
 products = os.getenv("MAPCACHE_PRODUCTS", " ".join(products)).split(" ")
 platforms = "g16 g17"
 platforms = os.getenv("MAPCACHE_PLATFORMS", platforms).split(" ")
-image_autoexpire = os.getenv("IMAGE_AUTOEXPIRE", "86400")
-basemap_autoexpire = os.getenv("BASEMAP_AUTOEXPIRE", "86400")
+# 86400 = 24 hours
+# this does not control when tiles are deleted from the cache, but rather
+# when they should be re-requested. A value of 0 means never re-request.
+# A non-zero value can be a good safety net to just make sure things are updated.
+image_autoexpire = os.getenv("IMAGE_AUTOEXPIRE", str(86400 * 7))
+basemap_autoexpire = os.getenv("BASEMAP_AUTOEXPIRE", "0")
 
 wms_host = os.environ['WMS_HOST']
 wms_port = os.environ['WMS_PORT']
-- 
GitLab