# 内存缓存工具 MemoryCache

## Feature

- 支持过期控制
- 支持内存缓存
- 满足最基本的缓存需求，读取`(get)`、写入`(set)` 和删除`(remove)`

## Usage

```js
export const cache = createMemoryCache();

// 内置方法
cache.get(key);
cache.set(key, value, expires);
cache.remove(key);
cache.clear();
```

## API

### cache.get

读取内存缓存

```ts
async function get(key: MemoryCacheKey, defaultValue?: any);
```

### cache.set

写入内存缓存，默认缓存过期时间是 `-1`, 表示永久不过期

```ts
async function set(key: MemoryCacheKey, value: any, expires: string | number);
```

### cache.remove

删除内存缓存

```ts
async function remove(key: MemoryCacheKey);
```

### cache.clear

清空全部内存缓存

```ts
async function clear();
```
