[mapserver-commits] r12441 - in trunk/mapserver/mapcache: . src
svn at osgeo.org
svn at osgeo.org
Fri Aug 26 07:26:20 EDT 2011
Author: tbonfort
Date: 2011-08-26 04:26:20 -0700 (Fri, 26 Aug 2011)
New Revision: 12441
Modified:
trunk/mapserver/mapcache/geocache.xml
trunk/mapserver/mapcache/src/cache_sqlite.c
Log:
seed in "depth first" mode, by recursively seeding the 4 tiles under the current one. this will make the seeder
be nicer on OS / DB caches
thomas.bonfort | 2011-08-25 18:53:26 +0200 (Thu, 25 Aug 2011)
Modified: trunk/mapserver/mapcache/geocache.xml
===================================================================
--- trunk/mapserver/mapcache/geocache.xml 2011-08-26 11:26:15 UTC (rev 12440)
+++ trunk/mapserver/mapcache/geocache.xml 2011-08-26 11:26:20 UTC (rev 12441)
@@ -535,7 +535,7 @@
<source>vmap0</source>
<!-- cache: the "name" attribute of a preconfigured <cache> -->
- <cache>disk</cache>
+ <cache>sqlite</cache>
<!-- grid: the "name" attribute of a preconfigured <grid>
you can also use the following notation to limit the area that will be cached and served to clients:
@@ -722,13 +722,13 @@
It will intercept wms getmap requests that can be treated from configured
tilesets, and can optionally forward all the rest to (an)other server(s)
TODO: this needs way more documenting
- -->
<forwarding_rule name="foo rule">
<append_pathinfo>true</append_pathinfo>
<http>
<url>http://localhost/</url>
</http>
</forwarding_rule>
+ -->
</service>
<service type="wmts" enabled="true"/>
<service type="tms" enabled="true"/>
Modified: trunk/mapserver/mapcache/src/cache_sqlite.c
===================================================================
--- trunk/mapserver/mapcache/src/cache_sqlite.c 2011-08-26 11:26:15 UTC (rev 12440)
+++ trunk/mapserver/mapcache/src/cache_sqlite.c 2011-08-26 11:26:20 UTC (rev 12441)
@@ -188,9 +188,9 @@
sqlite3_stmt *stmt;
char *sql;
if(tile->dimensions) {
- sql = "insert into tiles(x,y,z,data,dim) values (?,?,?,?,?)";
+ sql = "insert or replace into tiles(x,y,z,data,dim,ctime) values (?,?,?,?,?,datetime('now'))";
} else {
- sql = "insert into tiles(x,y,z,data) values (?,?,?,?)";
+ sql = "insert or replace into tiles(x,y,z,data,ctime) values (?,?,?,?,datetime('now'))";
}
sqlite3_prepare(handle, sql,-1,&stmt,NULL);
sqlite3_bind_int(stmt,1,tile->x);
@@ -242,12 +242,10 @@
geocache_grid *grid = gridlink->grid;
char *dbname = _get_dbname(ctx,(geocache_cache_sqlite*)cache,tileset,grid);
sqlite3_open(dbname, &db);
- sqlite3_exec(db, "create table if not exists tiles(x integer, y integer, z integer, data blob, ctime date, mtime date, atime date)", 0, 0, &errmsg);
- sqlite3_exec(db, "create index if not exists tilesidx on tiles (x,y,z)", 0, 0, &errmsg);
if(tileset->dimensions) {
- /* the following would return an error if the column already exists, but we ignore it */
- sqlite3_exec(db, "alter table tiles add column dim text",0, 0, &errmsg);
- sqlite3_exec(db, "create index if not exists tilesdimidx on tiles (dim)", 0, 0, &errmsg);
+ sqlite3_exec(db, "create table if not exists tiles(x integer, y integer, z integer, data blob, dim text, ctime datetime, atime datetime, hitcount integer default 0, primary key(x,y,z,dim))", 0, 0, &errmsg);
+ } else {
+ sqlite3_exec(db, "create table if not exists tiles(x integer, y integer, z integer, data blob, ctime datetime, atime datetime, hitcount integer default 0, primary key (x,y,z))", 0, 0, &errmsg);
}
sqlite3_close(db);
}
More information about the mapserver-commits
mailing list