# Collection: refresh() method

> The refresh() method of the Collection interface drops what the room holds of the collection's entries, so the next get() reads them again.

The **`refresh()`** method of the [`Collection`](/docs/room/collection) interface drops what the room's cache holds of the collection's entries, so the next [`get()`](/docs/room/collection/get) of each reads it from the data service.

## Syntax

```ts
refresh()
```

### Parameters

None.

### Return value

None (`undefined`).

## Description

Without `refresh()`, a write made outside the room shows in the room's `get()` within 5 seconds. `list()` is never cached, so it needs no refresh.

## Examples

### Rereading a level its author just edited

```ts
// reload.ts
import { defineRoom } from "@irtio/room";

export default defineRoom({
  async onMessage(room, connection, message) {
    const m = message as { type?: string; level?: string };
    if (m.type !== "reload" || typeof m.level !== "string") return;
    const levels = room.collection("levels");
    levels.refresh();
    const level = await levels.get(m.level);
    room.send(connection, { type: "level", level: level?.value ?? null });
  },
});
```

## See also

- [The cache in the room](/docs/room/guides/player-data#the-cache-in-the-room)
