Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,12 @@ async def _setup_collection(self, *, collection: str) -> None:

new_collection: AsyncCollection[dict[str, Any]] = await self._db.create_collection(name=collection)

# Index for efficient key lookups
_ = await new_collection.create_index(keys="key")

# TTL index for automatic expiration of entries when expires_at is reached
_ = await new_collection.create_index(keys="expires_at", expireAfterSeconds=0)

self._collections_by_name[collection] = new_collection

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,12 @@ def _setup_collection(self, *, collection: str) -> None:

new_collection: Collection[dict[str, Any]] = self._db.create_collection(name=collection)

# Index for efficient key lookups
_ = new_collection.create_index(keys="key")

# TTL index for automatic expiration of entries when expires_at is reached
_ = new_collection.create_index(keys="expires_at", expireAfterSeconds=0)

self._collections_by_name[collection] = new_collection

@override
Expand Down