You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
781 B
27 lines
781 B
'use strict';
|
|
|
|
var LruCache = require('lru-cache');
|
|
|
|
function LayergroupAffectedTables () {
|
|
// dbname + layergroupId -> affected tables cache
|
|
this.cache = new LruCache({ max: 2000 });
|
|
}
|
|
|
|
module.exports = LayergroupAffectedTables;
|
|
|
|
LayergroupAffectedTables.prototype.hasAffectedTables = function (dbName, layergroupId) {
|
|
return this.cache.has(createKey(dbName, layergroupId));
|
|
};
|
|
|
|
LayergroupAffectedTables.prototype.set = function (dbName, layergroupId, affectedTables) {
|
|
this.cache.set(createKey(dbName, layergroupId), affectedTables);
|
|
};
|
|
|
|
LayergroupAffectedTables.prototype.get = function (dbName, layergroupId) {
|
|
return this.cache.get(createKey(dbName, layergroupId));
|
|
};
|
|
|
|
function createKey (dbName, layergroupId) {
|
|
return dbName + ':' + layergroupId;
|
|
}
|