Bust cache with version

old-stable24
Varun Patil 2022-10-16 13:18:47 -07:00
parent f9861f331f
commit 1295c397a2
2 changed files with 4 additions and 1 deletions

View File

@ -69,6 +69,7 @@ class PageController extends Controller {
// Apps enabled // Apps enabled
$this->initialState->provideInitialState('systemtags', $this->appManager->isEnabledForUser('systemtags') === true); $this->initialState->provideInitialState('systemtags', $this->appManager->isEnabledForUser('systemtags') === true);
$this->initialState->provideInitialState('recognize', $this->appManager->isEnabledForUser('recognize') === true); $this->initialState->provideInitialState('recognize', $this->appManager->isEnabledForUser('recognize') === true);
$this->initialState->provideInitialState('version', $this->appManager->getAppInfo('memories')["version"]);
$response = new TemplateResponse($this->appName, 'main'); $response = new TemplateResponse($this->appName, 'main');
return $response; return $response;

View File

@ -1,5 +1,6 @@
import { getCanonicalLocale } from "@nextcloud/l10n"; import { getCanonicalLocale } from "@nextcloud/l10n";
import { getCurrentUser } from '@nextcloud/auth' import { getCurrentUser } from '@nextcloud/auth'
import { loadState } from '@nextcloud/initial-state'
import { IPhoto } from "../types"; import { IPhoto } from "../types";
// Memoize the result of short date conversions // Memoize the result of short date conversions
@ -166,7 +167,8 @@ export const constants = {
/** Cache store */ /** Cache store */
let cacheStorage: Cache | null = null; let cacheStorage: Cache | null = null;
caches.open(`memories-${getCurrentUser()!.uid}`).then((cache) => { cacheStorage = cache }); const cacheName = `memories-${loadState('memories', 'version')}-${getCurrentUser()!.uid}`;
caches.open(cacheName).then((cache) => { cacheStorage = cache });
/** Get data from the cache */ /** Get data from the cache */
export async function getCachedData(url: string) { export async function getCachedData(url: string) {