1.0.1 • Published 4 years ago

@aliwa/mapcache v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

使用方法

安装

npm i @aliwa/MapCache 

以下两种用法注意 async/await 的使用。

仅「缓存到内存」

const mapStore = await MapCache.store( storeName );

mapStore.has( key );
mapStore.get( key );
mapStore.set( key, value, expires ); // expires unit: ms
mapStore.delete( key );
mapStore.clear();

「缓存到内存」并「持久化到文件」

const mapStore = await MapCache.store( storeName, jsonFilePath );

mapStore.has( key );
mapStore.get( key );
await mapStore.set( key, value, expires ); // expires unit: ms
await mapStore.delete( key );
await mapStore.clear();