mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix domain cache by host
This commit is contained in:
1 file changed
+4
-1
@@ -89,6 +89,8 @@ class DomainModel {
|
|||||||
if (result) {
|
if (result) {
|
||||||
await bus.parallel('domain/get', result);
|
await bus.parallel('domain/get', result);
|
||||||
cache.set(key, result);
|
cache.set(key, result);
|
||||||
|
} else {
|
||||||
|
cache.set(key, null);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -305,12 +307,13 @@ export async function apply(ctx: Context) {
|
|||||||
for (const host of ddoc.host || []) {
|
for (const host of ddoc.host || []) {
|
||||||
cache.delete(`host::${host}`);
|
cache.delete(`host::${host}`);
|
||||||
}
|
}
|
||||||
cache.delete(`id::${domainId}`);
|
cache.delete(`id::${ddoc.lower}`);
|
||||||
});
|
});
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
db.ensureIndexes(
|
db.ensureIndexes(
|
||||||
coll,
|
coll,
|
||||||
{ key: { lower: 1 }, name: 'lower', unique: true },
|
{ key: { lower: 1 }, name: 'lower', unique: true },
|
||||||
|
{ key: { host: 1 }, name: 'host', unique: true },
|
||||||
),
|
),
|
||||||
db.ensureIndexes(
|
db.ensureIndexes(
|
||||||
collUser,
|
collUser,
|
||||||
|
|||||||
Reference in new issue
Block a user