fix: update cache + timeline when items are updated/deleted (#556)
This commit is contained in:
parent
720b5114af
commit
dc76ab2477
5 changed files with 28 additions and 15 deletions
|
@ -13,6 +13,9 @@ export function setCached(key: string, value: any, override = false) {
|
|||
if (override || !cache.has(key))
|
||||
cache.set(key, value)
|
||||
}
|
||||
function removeCached(key: string) {
|
||||
cache.delete(key)
|
||||
}
|
||||
|
||||
export function fetchStatus(id: string, force = false): Promise<Status> {
|
||||
const server = currentServer.value
|
||||
|
@ -82,6 +85,10 @@ export function cacheStatus(status: Status, server = currentServer.value, overri
|
|||
setCached(`${server}:status:${status.id}`, status, override)
|
||||
}
|
||||
|
||||
export function removeCachedStatus(id: string, server = currentServer.value) {
|
||||
removeCached(`${server}:status:${id}`)
|
||||
}
|
||||
|
||||
export function cacheAccount(account: Account, server = currentServer.value, override?: boolean) {
|
||||
setCached(`${server}:account:${account.id}`, account, override)
|
||||
setCached(`${server}:account:${account.acct}`, account, override)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue