Fix star rating issue
This commit is contained in:
parent
519e9ae5a2
commit
858857cc2e
@ -17,7 +17,9 @@ export default async function handler(req, res) {
|
|||||||
|
|
||||||
const exists = await RedisUtils.exists(`${KEY}${mapHash}`);
|
const exists = await RedisUtils.exists(`${KEY}${mapHash}`);
|
||||||
if (exists) {
|
if (exists) {
|
||||||
const data = await RedisUtils.getValue(`${KEY}${mapHash}`);
|
const data = await RedisUtils.getValue(
|
||||||
|
`${KEY}-${difficulty}-${characteristic}-${mapHash}`
|
||||||
|
);
|
||||||
res.setHeader("Cache-Status", "hit");
|
res.setHeader("Cache-Status", "hit");
|
||||||
|
|
||||||
return res.status(200).json({
|
return res.status(200).json({
|
||||||
@ -43,7 +45,10 @@ export default async function handler(req, res) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
const json = await data.json();
|
const json = await data.json();
|
||||||
RedisUtils.setValue(`${KEY}${mapHash}`, json.difficulty.stars);
|
RedisUtils.setValue(
|
||||||
|
`${KEY}-${difficulty}-${characteristic}-${mapHash}`,
|
||||||
|
json.difficulty.stars
|
||||||
|
);
|
||||||
res.setHeader("Cache-Status", "miss");
|
res.setHeader("Cache-Status", "miss");
|
||||||
return res.status(200).json({
|
return res.status(200).json({
|
||||||
status: "OK",
|
status: "OK",
|
||||||
|
Reference in New Issue
Block a user