@spotify/web-api-ts-sdk
Version:
A typescript SDK for the Spotify Web API
23 lines (18 loc) • 579 B
text/typescript
import GenericCache from "./GenericCache.js";
import type { ICacheStore } from "./ICacheStore.js";
export default class LocalStorageCachingStrategy extends GenericCache {
constructor() {
super(new LocalStorageCacheStore());
}
}
class LocalStorageCacheStore implements ICacheStore {
public get(key: string): string | null {
return localStorage.getItem(key);
}
public set(key: string, value: string): void {
localStorage.setItem(key, value);
}
public remove(key: string): void {
localStorage.removeItem(key);
}
}