tilelive-cache

0.7.2 • Public • Published

tilelive-cache

I am a caching wrapper for tilelive.js. I cache both sources and data produced by their respective getTile() functions.

Usage

var tilelive = require("tilelive"),
    cache = require("tilelive-cache")(tilelive, {
      size: 10,      // 10MB cache (the default)
      sources: 6     // cache a maximum of 6 sources (the default); you may
                     // need to change this if you're using lots of
                     // composed sources
    });
 
// ...
 
// initializes or loads a tilelive-mapnik source
cache.load("mapnik://./stylesheet.xml", function(err, source) {
  // ...
 
  // generates or loads a tile from the cache
  return source.getTile(12, 1213, 1491, function(err, data, headers) {
    // ...
  });
});

To warm the cache, call load() without a callback:

cache.load("mapnik://./stylesheet.xml");

Readme

Keywords

none

Package Sidebar

Install

npm i tilelive-cache

Weekly Downloads

36

Version

0.7.2

License

BSD-2-Clause

Unpacked Size

12.9 kB

Total Files

5

Last publish

Collaborators

  • mojodna