@@ -39,11 +39,11 @@ function transformAggsToAttributeListParam (aggregations): AttributeListParam {
3939/**
4040 * Returns attributes from cache
4141 */
42- async function getAttributeFromCache ( attributeCode : string , config ) {
42+ async function getAttributeFromCache ( attributeCode : string , config , indexName ) {
4343 if ( config . server . useOutputCache && cache ) {
4444 try {
4545 const res = await ( cache as TagCache ) . get (
46- 'api:attribute-list' + attributeCode
46+ 'api:' + indexName + ': attribute-list: ' + attributeCode
4747 )
4848 return res
4949 } catch ( err ) {
@@ -56,12 +56,12 @@ async function getAttributeFromCache (attributeCode: string, config) {
5656/**
5757 * Save attributes in cache
5858 */
59- async function setAttributeInCache ( attributeList , config ) {
59+ async function setAttributeInCache ( attributeList , config , indexName ) {
6060 if ( config . server . useOutputCache && cache ) {
6161 try {
6262 await Promise . all (
6363 attributeList . map ( attribute => ( cache as TagCache ) . set (
64- 'api:attribute-list' + attribute . attribute_code ,
64+ 'api:' + indexName + ': attribute-list: ' + attribute . attribute_code ,
6565 attribute ,
6666 [ 'attribute' ]
6767 ) )
@@ -91,7 +91,7 @@ async function list (attributesParam: AttributeListParam, config, indexName: str
9191
9292 // here we check if some of attribute are in cache
9393 const rawCachedAttributeList = await Promise . all (
94- attributeCodes . map ( attributeCode => getAttributeFromCache ( attributeCode , config ) )
94+ attributeCodes . map ( attributeCode => getAttributeFromCache ( attributeCode , config , indexName ) )
9595 )
9696
9797 const cachedAttributeList = rawCachedAttributeList
@@ -126,7 +126,7 @@ async function list (attributesParam: AttributeListParam, config, indexName: str
126126 const fetchedAttributeList = get ( response . body , 'hits.hits' , [ ] ) . map ( hit => hit . _source )
127127
128128 // save atrributes in cache
129- await setAttributeInCache ( fetchedAttributeList , config )
129+ await setAttributeInCache ( fetchedAttributeList , config , indexName )
130130
131131 // cached and fetched attributes
132132 const allAttributes = [
0 commit comments