Use template string

This commit is contained in:
Daniel García Aubert 2019-09-13 18:03:39 +02:00
parent d99e5a44f5
commit b55c2ec55c

View File

@ -1,10 +1,10 @@
'use strict';
const NamedMapMapConfigProvider = require('../models/mapconfig/provider/named-map-provider');
const templateName = require('../backends/template_maps').templateName;
const LruCache = require("lru-cache");
const NamedMapMapConfigProvider = require('../models/mapconfig/provider/named-map-provider');
const { templateName } = require('../backends/template_maps');
const TEN_MINUTES_IN_MILLISECONDS = 1000 * 60 * 10;
const ACTIONS = ['update', 'delete'];
@ -62,13 +62,13 @@ NamedMapProviderCache.prototype.invalidate = function(user, templateId) {
this.providerCache.del(createNamedMapKey(user, templateId));
};
function createNamedMapKey(user, templateId) {
return user + ':' + templateName(templateId);
function createNamedMapKey (user, templateId) {
return `${user}:${templateName(templateId)}`;
}
const providerKeyTpl = ctx => `${ctx.authToken}:${ctx.configHash}:${ctx.format}:${ctx.layer}:${ctx.scale_factor}`;
function createProviderKey(config, authToken, params) {
function createProviderKey (config, authToken, params) {
const defaults = {
authToken: authToken || '',
configHash: NamedMapMapConfigProvider.configHash(config),