Skip to content
This repository was archived by the owner on May 28, 2023. It is now read-only.

Commit c394334

Browse files
authored
Merge pull request #585 from vuestorefront/hotfix/v1.12.5
Release - Hotfix/v1.12.5
2 parents eefe4ef + e7a5fbd commit c394334

File tree

4 files changed

+29
-23
lines changed

4 files changed

+29
-23
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [1.12.5] - 2021.11.02
8+
9+
### Fixed
10+
- Fix caching of attributes. They were missing cache tag, preventing them from being purged correctly and also not separated cache key between multi stores (#583)
11+
712
## [1.12.4] - 2021.01.15
813

914
### Fixed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-storefront-api",
3-
"version": "1.12.4",
3+
"version": "1.12.5",
44
"private": true,
55
"description": "vue-storefront API and data services",
66
"main": "dist",

src/api/attribute/service.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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,13 +56,14 @@ 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,
65-
attribute
64+
'api:' + indexName + ':attribute-list:' + attribute.attribute_code,
65+
attribute,
66+
['attribute']
6667
))
6768
)
6869
} catch (err) {
@@ -90,7 +91,7 @@ async function list (attributesParam: AttributeListParam, config, indexName: str
9091

9192
// here we check if some of attribute are in cache
9293
const rawCachedAttributeList = await Promise.all(
93-
attributeCodes.map(attributeCode => getAttributeFromCache(attributeCode, config))
94+
attributeCodes.map(attributeCode => getAttributeFromCache(attributeCode, config, indexName))
9495
)
9596

9697
const cachedAttributeList = rawCachedAttributeList
@@ -125,7 +126,7 @@ async function list (attributesParam: AttributeListParam, config, indexName: str
125126
const fetchedAttributeList = get(response.body, 'hits.hits', []).map(hit => hit._source)
126127

127128
// save atrributes in cache
128-
await setAttributeInCache(fetchedAttributeList, config)
129+
await setAttributeInCache(fetchedAttributeList, config, indexName)
129130

130131
// cached and fetched attributes
131132
const allAttributes = [

yarn.lock

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4415,9 +4415,9 @@ lru-cache@^5.0.0:
44154415
dependencies:
44164416
yallist "^3.0.2"
44174417

4418-
"mage2vuestorefront@git+https://github.com/DivanteLtd/mage2vuestorefront.git":
4419-
version "1.11.0"
4420-
resolved "git+https://github.com/DivanteLtd/mage2vuestorefront.git#6b477d35b6d11f935b1643938881969f16c87c04"
4418+
"mage2vuestorefront@git+https://github.com/vuestorefront/mage2vuestorefront.git":
4419+
version "1.11.1"
4420+
resolved "git+https://github.com/vuestorefront/mage2vuestorefront.git#a2abf48ec40d9fb761ee3f5117a1c87dc7f7c0c6"
44214421
dependencies:
44224422
"@elastic/elasticsearch" "^7.3.0"
44234423
agentkeepalive "^3.3.0"
@@ -4428,8 +4428,8 @@ lru-cache@^5.0.0:
44284428
jsonfile "^4.0.0"
44294429
jwt-simple "^0.5.1"
44304430
kue "^0.11.5"
4431-
lodash "^4.17.13"
4432-
magento2-rest-client "0.0.2"
4431+
lodash "^4.17.19"
4432+
magento2-rest-client "https://github.com/DivanteLtd/magento2-rest-client"
44334433
moment "^2.22.2"
44344434
node-sync "^0.2.1"
44354435
passport "^0.3.2"
@@ -4449,19 +4449,19 @@ lru-cache@^5.0.0:
44494449
request "^2.72.0"
44504450
winston "^2.2.0"
44514451

4452-
magento2-rest-client@0.0.2:
4453-
version "0.0.2"
4454-
resolved "https://registry.yarnpkg.com/magento2-rest-client/-/magento2-rest-client-0.0.2.tgz#2a6ef230c88129a8680b63ead3793ea7e99bf6a4"
4455-
integrity sha1-Km7yMMiBKahoC2Pq03k+p+mb9qQ=
4452+
"magento2-rest-client@github:vuestorefront/magento2-rest-client":
4453+
version "0.0.14"
4454+
uid "3ed81008e617abfed347ed42fb52ac9d72c8705b"
4455+
resolved "https://codeload.github.com/vuestorefront/magento2-rest-client/tar.gz/3ed81008e617abfed347ed42fb52ac9d72c8705b"
44564456
dependencies:
44574457
humps "^1.1.0"
44584458
oauth-1.0a "^1.0.1"
44594459
request "^2.72.0"
44604460
winston "^2.2.0"
44614461

4462-
"magento2-rest-client@github:DivanteLtd/magento2-rest-client":
4463-
version "0.0.12"
4464-
resolved "https://codeload.github.com/DivanteLtd/magento2-rest-client/tar.gz/fb5adcb24fe25e097c2127a3ded5ef05e0fcb2f7"
4462+
"magento2-rest-client@https://github.com/DivanteLtd/magento2-rest-client":
4463+
version "0.0.14"
4464+
resolved "https://github.com/DivanteLtd/magento2-rest-client#3ed81008e617abfed347ed42fb52ac9d72c8705b"
44654465
dependencies:
44664466
humps "^1.1.0"
44674467
oauth-1.0a "^1.0.1"
@@ -6694,9 +6694,9 @@ stealthy-require@^1.1.1:
66946694
version "1.1.1"
66956695
resolved "https://registry.yarnpkg.com/stealthy-require/-/stealthy-require-1.1.1.tgz#35b09875b4ff49f26a777e509b3090a3226bf24b"
66966696

6697-
"storefront-query-builder@https://github.com/DivanteLtd/storefront-query-builder.git":
6698-
version "1.0.1"
6699-
resolved "https://github.com/DivanteLtd/storefront-query-builder.git#0ef1f9760eb44edce5b9464a9145ce0a7517a419"
6697+
"storefront-query-builder@https://github.com/vuestorefront/storefront-query-builder.git":
6698+
version "1.0.2"
6699+
resolved "https://github.com/vuestorefront/storefront-query-builder.git#7416993f07927f598d22ca448462f0d3f0288f20"
67006700
dependencies:
67016701
"@typescript-eslint/parser" "^2.26.0"
67026702
clone-deep "^4.0.1"

0 commit comments

Comments
 (0)