Windshaft-cartodb/lib/cache/model/named-maps-entry.js

20 lines
432 B
JavaScript
Raw Normal View History

'use strict';
2015-01-23 23:37:38 +08:00
var crypto = require('crypto');
2019-10-22 01:07:24 +08:00
function NamedMaps (owner, name) {
2015-01-23 23:37:38 +08:00
this.namespace = 'n';
this.owner = owner;
this.name = name;
}
module.exports = NamedMaps;
2019-10-22 01:07:24 +08:00
NamedMaps.prototype.key = function () {
2015-01-23 23:37:38 +08:00
return this.namespace + ':' + shortHashKey(this.owner + ':' + this.name);
};
2019-10-22 01:07:24 +08:00
function shortHashKey (target) {
return crypto.createHash('sha256').update(target).digest('base64').substring(0, 6);
2015-01-23 23:37:38 +08:00
}