src/MemoryStorage.ts
Methods |
Accessors |
| Public clear |
clear()
|
|
Defined in src/MemoryStorage.ts:27
|
|
Returns :
void
|
| Public getItem | ||||||||
getItem(key: string)
|
||||||||
|
Defined in src/MemoryStorage.ts:15
|
||||||||
|
Parameters :
Returns :
any
|
| Public hasItem | ||||||||
hasItem(key: string)
|
||||||||
|
Defined in src/MemoryStorage.ts:11
|
||||||||
|
Parameters :
Returns :
any
|
| Public key | ||||||||
key(index: number)
|
||||||||
|
Defined in src/MemoryStorage.ts:31
|
||||||||
|
Parameters :
Returns :
any
|
| Public removeItem | ||||||||
removeItem(key: string)
|
||||||||
|
Defined in src/MemoryStorage.ts:23
|
||||||||
|
Parameters :
Returns :
void
|
| Public setItem |
setItem(key: string, value: string)
|
|
Defined in src/MemoryStorage.ts:19
|
|
Returns :
void
|
| length |
getlength()
|
|
Defined in src/MemoryStorage.ts:35
|
import {ICustomStorage} from './metadata'
// This is dumb TODO: REMOVE
declare const Map: any
const _cache = new Map()
const getKeys = (): any[] => Array.from(_cache.keys())
export class MemoryStorage implements ICustomStorage {
public hasItem(key: string) {
return _cache.has(key)
}
public getItem(key: string) {
return _cache.get(key)
}
public setItem(key: string, value: string) {
_cache.set(key, value)
}
public removeItem(key: string) {
_cache.delete(key)
}
public clear() {
_cache.clear()
}
public key(index: number) {
return getKeys()[index]
}
public get length() {
return getKeys().length
}
}