()
| 96 | } |
| 97 | |
| 98 | async clear() { |
| 99 | const sessionID = await this.getSessionID() |
| 100 | const list = await this.env.Bucket.list({ |
| 101 | prefix: `session/message/${sessionID}/`, |
| 102 | limit: 1000, |
| 103 | }) |
| 104 | for (const item of list.objects) { |
| 105 | await this.env.Bucket.delete(item.key) |
| 106 | } |
| 107 | await this.env.Bucket.delete(`session/info/${sessionID}`) |
| 108 | await this.ctx.storage.deleteAll() |
| 109 | } |
| 110 | |
| 111 | static shortName(id: string) { |
| 112 | return id.substring(id.length - 8) |